public class GenericDAO extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericDAO.Parameters
Helper to create dynamic parameter for the GenericDAO.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.beanutils.BeanUtilsBean |
beanUtil
Utility on bean
|
protected org.apache.commons.beanutils.ConvertUtilsBean |
convertUtils
Utility to convert value
|
protected Class<? extends IdentifiableEntity> |
entityClass
Current entity class do crud
|
protected javax.persistence.EntityManager |
manager
Current entity manager
|
protected org.apache.commons.beanutils.PropertyUtilsBean |
propertyUtils
Utility on property
|
| Constructor and Description |
|---|
GenericDAO(javax.persistence.EntityManager manager,
Class<? extends IdentifiableEntity> entityClass)
Constructor with direct entity class.
|
GenericDAO(javax.persistence.EntityManager manager,
String entityName)
Constructor with entity class as string.
|
| Modifier and Type | Method and Description |
|---|---|
IdentifiableEntity |
create(GenericDAO.Parameters parameters)
Create an entity with parameters.
|
boolean |
delete(String id)
Delete an entity, that is identified by this id.
|
int |
exec(String name,
GenericDAO.Parameters parameters)
Execute a query named as write in entity.
|
protected IdentifiableEntity |
extract(GenericDAO.Parameters parameters)
Create a new entity with parameters.
|
protected IdentifiableEntity |
extract(IdentifiableEntity entity,
GenericDAO.Parameters parameters)
Complete entity with parameters.
|
protected void |
extract(javax.persistence.Query query,
GenericDAO.Parameters parameters)
Set parameter in the query.
|
IdentifiableEntity |
find(String id)
Find entity by the id.
|
List |
query(String name,
GenericDAO.Parameters parameters)
Execute a query named as read in entity.
|
IdentifiableEntity |
update(String id,
GenericDAO.Parameters parameters)
Update an entity with parameters, that is identified by this id.
|
protected org.apache.commons.beanutils.BeanUtilsBean beanUtil
protected org.apache.commons.beanutils.ConvertUtilsBean convertUtils
protected org.apache.commons.beanutils.PropertyUtilsBean propertyUtils
protected javax.persistence.EntityManager manager
protected Class<? extends IdentifiableEntity> entityClass
public GenericDAO(javax.persistence.EntityManager manager,
Class<? extends IdentifiableEntity> entityClass)
manager - entity managerentityClass - entity classpublic GenericDAO(javax.persistence.EntityManager manager,
String entityName)
manager - entity managerentityName - entity class as stringpublic IdentifiableEntity create(GenericDAO.Parameters parameters)
parameters - parameterspublic IdentifiableEntity update(String id, GenericDAO.Parameters parameters)
id - identifierparameters - parameterspublic boolean delete(String id)
id - identifierpublic IdentifiableEntity find(String id)
id - identifierpublic List query(String name, GenericDAO.Parameters parameters)
name - query nameparameters - parameterspublic int exec(String name, GenericDAO.Parameters parameters)
name - query nameparameters - parametersprotected void extract(javax.persistence.Query query,
GenericDAO.Parameters parameters)
query - queryparameters - parametersprotected IdentifiableEntity extract(GenericDAO.Parameters parameters)
parameters - parametersprotected IdentifiableEntity extract(IdentifiableEntity entity, GenericDAO.Parameters parameters)
entity - entityparameters - parametersCopyright © 2011–2014 Debux. All rights reserved.