public class GenericDao
extends java.lang.Object
Constructor and Description |
---|
GenericDao(DbOom dbOom) |
Modifier and Type | Method and Description |
---|---|
long |
count(java.lang.Class entityType)
Counts number of all entities.
|
<ID> void |
decreaseProperty(java.lang.Class entityType,
ID id,
java.lang.String name,
java.lang.Number delta)
Decreases a property.
|
void |
deleteAllById(java.lang.Iterable objects)
Deletes all objects by their ids.
|
<ID> void |
deleteById(java.lang.Class entityType,
ID id)
Deleted single entity by its id.
|
void |
deleteById(java.lang.Object entity)
Delete single object by its id.
|
<E> java.util.List<E> |
find(java.lang.Class<E> entityType,
java.lang.Object criteria)
Finds list of entities matching given criteria.
|
<E> java.util.List<E> |
find(java.lang.Object criteria)
Finds list of entities matching given criteria.
|
<E,ID> E |
findById(java.lang.Class<E> entityType,
ID id)
Finds single entity by its id.
|
<E> E |
findOne(java.lang.Object criteria)
Finds one entity for given criteria.
|
<E> E |
findOneByProperty(java.lang.Class<E> entityType,
java.lang.String name,
java.lang.Object value)
Finds single entity by matching property.
|
<E> java.util.List<E> |
findRelated(java.lang.Class<E> target,
java.lang.Object source)
Finds related entity.
|
protected <ID> ID |
generateNextId(DbEntityDescriptor dbEntityDescriptor)
Generates next id for given type.
|
<ID> void |
increaseProperty(java.lang.Class entityType,
ID id,
java.lang.String name,
java.lang.Number delta)
Increases a property.
|
protected <E> boolean |
isPersistent(DbEntityDescriptor<E> ded,
E entity)
Returns
true if entity is persistent. |
<E> java.util.List<E> |
listAll(java.lang.Class<E> target)
List all entities.
|
void |
save(java.lang.Object entity)
Simply inserts object into the database.
|
void |
saveAll(java.lang.Iterable entities)
Inserts bunch of objects into the database.
|
protected <E,ID> void |
setEntityId(DbEntityDescriptor<E> ded,
E entity,
ID newIdValue)
Sets new ID value for entity.
|
<E> E |
store(E entity)
Saves or updates entity.
|
void |
update(java.lang.Object entity)
Updates single entity.
|
void |
updateAll(java.lang.Iterable entities)
Updates all entities.
|
<E> E |
updateProperty(E entity,
java.lang.String name)
Updates property in the database by storing the current property value.
|
<E> E |
updateProperty(E entity,
java.lang.String name,
java.lang.Object newValue)
Updates single property in database and in the bean.
|
public GenericDao(DbOom dbOom)
protected <E> boolean isPersistent(DbEntityDescriptor<E> ded, E entity)
true
if entity is persistent.protected <E,ID> void setEntityId(DbEntityDescriptor<E> ded, E entity, ID newIdValue)
protected <ID> ID generateNextId(DbEntityDescriptor dbEntityDescriptor)
public <E> E store(E entity)
null
, entity will be updated.
Otherwise, entity will be inserted into the database.public void save(java.lang.Object entity)
public void saveAll(java.lang.Iterable entities)
save(Object)
public void update(java.lang.Object entity)
public void updateAll(java.lang.Iterable entities)
update(Object)
public <E> E updateProperty(E entity, java.lang.String name, java.lang.Object newValue)
public <E> E updateProperty(E entity, java.lang.String name)
public <E,ID> E findById(java.lang.Class<E> entityType, ID id)
public <E> E findOneByProperty(java.lang.Class<E> entityType, java.lang.String name, java.lang.Object value)
public <E> E findOne(java.lang.Object criteria)
public <E> java.util.List<E> find(java.lang.Object criteria)
public <E> java.util.List<E> find(java.lang.Class<E> entityType, java.lang.Object criteria)
public <ID> void deleteById(java.lang.Class entityType, ID id)
public void deleteById(java.lang.Object entity)
public void deleteAllById(java.lang.Iterable objects)
public long count(java.lang.Class entityType)
public <ID> void increaseProperty(java.lang.Class entityType, ID id, java.lang.String name, java.lang.Number delta)
public <ID> void decreaseProperty(java.lang.Class entityType, ID id, java.lang.String name, java.lang.Number delta)
public <E> java.util.List<E> findRelated(java.lang.Class<E> target, java.lang.Object source)
public <E> java.util.List<E> listAll(java.lang.Class<E> target)
Copyright © 2003-present Jodd Team