@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(String query,
Object... params)
Count entities with a special query.
|
boolean |
create()
store (ie insert) the entity.
|
static <T extends JPABase> |
create(Class<?> type,
String name,
Map<String,String[]> params,
Annotation[] annotations)
Deprecated.
|
static <T extends JPABase> |
create(ParamNode rootParamNode,
String name,
Class<?> type,
Annotation[] annotations) |
static <T extends JPABase> |
create(String name,
Scope.Params params) |
<T extends JPABase> |
delete()
Delete the entity.
|
static int |
delete(String query,
Object... params)
Batch delete of entities
|
static int |
deleteAll()
Delete all entities
|
static <T extends JPABase> |
edit(Object o,
String name,
Map<String,String[]> params,
Annotation[] annotations)
Deprecated.
|
<T extends GenericModel> |
edit(ParamNode rootParamNode,
String name) |
static <T extends JPABase> |
edit(ParamNode rootParamNode,
String name,
Object o,
Annotation[] annotations) |
<T extends GenericModel> |
edit(String name,
Map<String,String[]> params)
Deprecated.
|
<T extends GenericModel> |
edit(String dbName,
ParamNode rootParamNode,
String name) |
static <T extends JPABase> |
edit(String dbName,
ParamNode rootParamNode,
String name,
Object o,
Annotation[] annotations) |
static GenericModel.JPAQuery |
find(String query,
Object... params)
Prepare a query to find entities.
|
static <T extends JPABase> |
findAll()
Find all entities of this type
|
static <T extends JPABase> |
findById(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() |
boolean |
validateAndSave() |
_delete, _key, _save, em, em, equals, getEntityId, hashCode, isPersistent, isPersistent, toString
@Deprecated public static <T extends JPABase> T create(Class<?> type, String name, Map<String,String[]> params, Annotation[] annotations)
public static <T extends JPABase> T create(ParamNode rootParamNode, String name, Class<?> type, Annotation[] annotations)
@Deprecated public static <T extends JPABase> T edit(Object o, String name, Map<String,String[]> params, Annotation[] annotations)
edit(ParamNode, String, Object, Annotation[])
public static <T extends JPABase> T edit(ParamNode rootParamNode, String name, Object o, Annotation[] annotations)
public static <T extends JPABase> T edit(String dbName, ParamNode rootParamNode, String name, Object o, Annotation[] annotations)
@Deprecated public <T extends GenericModel> T edit(String name, Map<String,String[]> params)
public <T extends GenericModel> T edit(ParamNode rootParamNode, String name)
public <T extends GenericModel> T edit(String dbName, ParamNode rootParamNode, String name)
public boolean validateAndSave()
public boolean validateAndCreate()
public <T extends JPABase> T save()
public boolean create()
public <T extends JPABase> T refresh()
public <T extends JPABase> T merge()
public <T extends JPABase> T delete()
public static <T extends JPABase> T create(String name, Scope.Params params)
public static long count()
public static long count(String query, Object... params)
query
- HQL query or shortcutparams
- Params to bind to the querypublic static <T extends JPABase> T findById(Object id)
id
- The entity idpublic static GenericModel.JPAQuery find(String query, Object... params)
query
- HQL query or shortcutparams
- Params to bind to the querypublic static GenericModel.JPAQuery all()
public static int delete(String query, 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