@MappedSuperclass public class GenericModel extends JPABase
Modifier and Type | Class and Description |
---|---|
static class |
GenericModel.JPAQuery
A JPAQuery
|
JPABase.JPAQueryException
Model.BinaryField, Model.Choices, Model.Factory, Model.Manager, Model.Property
willBeSaved
Constructor and Description |
---|
GenericModel() |
Modifier and Type | Method and Description |
---|---|
void |
_saveAttachment() |
void |
_setupAttachment() |
static GenericModel.JPAQuery |
all()
Prepare a query to find *all* entities.
|
static long |
count()
Count entities
|
static long |
count(java.lang.String query,
java.lang.Object... params)
Count entities with a special query.
|
boolean |
create()
store (ie insert) the entity.
|
static <T extends JPABase> |
create(java.lang.Class<?> type,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String[]> params,
java.lang.annotation.Annotation[] annotations)
Deprecated.
use method {
create(ParamNode, String, Class, Annotation[]) } |
static <T extends JPABase> |
create(ParamNode rootParamNode,
java.lang.String name,
java.lang.Class<?> type,
java.lang.annotation.Annotation[] annotations)
Create a new model
|
static <T extends JPABase> |
create(java.lang.String name,
Scope.Params params)
Create the new entity
|
<T extends JPABase> |
delete()
Delete the entity.
|
static int |
delete(java.lang.String query,
java.lang.Object... params)
Batch delete of entities
|
static int |
deleteAll()
Delete all entities
|
static <T extends JPABase> |
edit(java.lang.Object o,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String[]> params,
java.lang.annotation.Annotation[] annotations)
Deprecated.
use method {
edit(ParamNode, String, Object, Annotation[]) } |
<T extends GenericModel> |
edit(ParamNode rootParamNode,
java.lang.String name)
Edit a model
|
static <T extends JPABase> |
edit(ParamNode rootParamNode,
java.lang.String name,
java.lang.Object o,
java.lang.annotation.Annotation[] annotations)
Edit a model
|
<T extends GenericModel> |
edit(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String[]> params)
Deprecated.
use method {
edit(ParamNode, String) } |
<T extends GenericModel> |
edit(java.lang.String dbName,
ParamNode rootParamNode,
java.lang.String name)
Edit a model
|
static <T extends JPABase> |
edit(java.lang.String dbName,
ParamNode rootParamNode,
java.lang.String name,
java.lang.Object o,
java.lang.annotation.Annotation[] annotations)
Edit a model
|
static GenericModel.JPAQuery |
find(java.lang.String query,
java.lang.Object... params)
Prepare a query to find entities.
|
static <T extends JPABase> |
findAll()
Find all entities of this type
|
static <T extends JPABase> |
findById(java.lang.Object id)
Find the entity with the corresponding id.
|
<T extends JPABase> |
merge()
Merge this object to obtain a managed entity (useful when the object comes from the Cache).
|
<T extends JPABase> |
refresh()
Refresh the entity state.
|
<T extends JPABase> |
save()
store (ie insert) the entity.
|
boolean |
validateAndCreate()
Validate and create the entity
|
boolean |
validateAndSave()
Validate and store the entity
|
_delete, _key, _save, em, em, equals, getEntityId, hashCode, isPersistent, isPersistent, toString
@Deprecated public static <T extends JPABase> T create(java.lang.Class<?> type, java.lang.String name, java.util.Map<java.lang.String,java.lang.String[]> params, java.lang.annotation.Annotation[] annotations)
create(ParamNode, String, Class, Annotation[])
}T
- The entity classtype
- the class of the objectname
- name of the objectparams
- parameters used to create the new objectannotations
- annotations on the modelpublic static <T extends JPABase> T create(ParamNode rootParamNode, java.lang.String name, java.lang.Class<?> type, java.lang.annotation.Annotation[] annotations)
T
- The entity classrootParamNode
- parameters used to create the new objectname
- name of the objecttype
- the class of the objectannotations
- annotations on the model@Deprecated public static <T extends JPABase> T edit(java.lang.Object o, java.lang.String name, java.util.Map<java.lang.String,java.lang.String[]> params, java.lang.annotation.Annotation[] annotations)
edit(ParamNode, String, Object, Annotation[])
}T
- class of the entityo
- Object to editname
- name of the objectparams
- list of parametersannotations
- annotations on the modeledit(ParamNode, String, Object, Annotation[])
public static <T extends JPABase> T edit(ParamNode rootParamNode, java.lang.String name, java.lang.Object o, java.lang.annotation.Annotation[] annotations)
T
- class of the entityrootParamNode
- parameters used to create the new objectname
- name of the objecto
- the entity to updateannotations
- annotations on the modelpublic static <T extends JPABase> T edit(java.lang.String dbName, ParamNode rootParamNode, java.lang.String name, java.lang.Object o, java.lang.annotation.Annotation[] annotations)
T
- class of the entitydbName
- the db namerootParamNode
- parameters used to create the new objectname
- name of the objecto
- the entity to updateannotations
- annotations on the model@Deprecated public <T extends GenericModel> T edit(java.lang.String name, java.util.Map<java.lang.String,java.lang.String[]> params)
edit(ParamNode, String)
}T
- class of the entityname
- name of the entityparams
- list of parameterspublic <T extends GenericModel> T edit(ParamNode rootParamNode, java.lang.String name)
T
- class of the entityrootParamNode
- parameters used to create the new objectname
- name of the entitypublic <T extends GenericModel> T edit(java.lang.String dbName, ParamNode rootParamNode, java.lang.String name)
T
- class of the entitydbName
- the db namerootParamNode
- parameters used to create the new objectname
- name of the entitypublic boolean validateAndSave()
public boolean validateAndCreate()
public <T extends JPABase> T save()
T
- class of the entitypublic boolean create()
public <T extends JPABase> T refresh()
T
- class of the entitypublic <T extends JPABase> T merge()
T
- class of the entitypublic <T extends JPABase> T delete()
T
- class of the entitypublic static <T extends JPABase> T create(java.lang.String name, Scope.Params params)
T
- class of the entityname
- name of the modelparams
- list of parameterspublic static long count()
public static long count(java.lang.String query, java.lang.Object... params)
query
- HQL query or shortcutparams
- Params to bind to the querypublic static <T extends JPABase> java.util.List<T> findAll()
T
- the type of the entitypublic static <T extends JPABase> T findById(java.lang.Object id)
T
- the type of the entityid
- The entity idpublic static GenericModel.JPAQuery find(java.lang.String query, java.lang.Object... params)
query
- HQL query or shortcutparams
- Params to bind to the querypublic static GenericModel.JPAQuery all()
public static int delete(java.lang.String query, java.lang.Object... params)
query
- HQL query or shortcutparams
- Params to bind to the querypublic static int deleteAll()
public void _setupAttachment()
public void _saveAttachment()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly