public interface GeneralDAO
Modifier and Type | Method and Description |
---|---|
int |
count(ISearch search)
Returns the total number of results that would be returned using the
given
ISearch if there were no paging or maxResults limits. |
<T> T[] |
find(java.lang.Class<T> type,
java.io.Serializable... ids)
Get all entities of the specified type from the datastore that have one
of these ids.
|
<T> T |
find(java.lang.Class<T> type,
java.io.Serializable id)
Get the entity with the specified type and id from the datastore.
|
<T> java.util.List<T> |
findAll(java.lang.Class<T> type)
Get a list of all the objects of the specified type.
|
void |
flush()
Flushes changes in the Hibernate session to the datastore.
|
Filter |
getFilterFromExample(java.lang.Object example)
Generates a search filter from the given example using default options.
|
Filter |
getFilterFromExample(java.lang.Object example,
ExampleOptions options)
Generates a search filter from the given example using the specified options.
|
<T> T |
getReference(java.lang.Class<T> type,
java.io.Serializable id)
Get a reference to the entity with the specified type and id from the
datastore.
|
<T> T[] |
getReferences(java.lang.Class<T> type,
java.io.Serializable... ids)
Get a reference to the entities of the specified type with the given ids
from the datastore.
|
boolean |
isAttached(java.lang.Object entity)
Returns
true if the object is connected to the current
Hibernate session. |
void |
refresh(java.lang.Object... entities)
Refresh the content of the given entity from the current datastore state.
|
void |
remove(java.lang.Object... entities)
Remove all of the specified entities from the datastore.
|
boolean |
remove(java.lang.Object entity)
Remove the specified entity from the datastore.
|
boolean |
removeById(java.lang.Class<?> type,
java.io.Serializable id)
Remove the entity with the specified type and id from the datastore.
|
void |
removeByIds(java.lang.Class<?> type,
java.io.Serializable... ids)
Remove all the entities of the given type from the datastore that have
one of these ids.
|
boolean[] |
save(java.lang.Object... entities)
For each entity, if the id of the entity is null or zero, add it to the
datastore and assign it an id; otherwise, update the corresponding entity
in the datastore with the properties of this entity.
|
boolean |
save(java.lang.Object entity)
If the id of the entity is null or zero, add it to the datastore and
assign it an id; otherwise, update the corresponding entity in the
datastore with the properties of this entity.
|
java.util.List |
search(ISearch search)
Search for objects given the search parameters in the specified
ISearch object. |
SearchResult |
searchAndCount(ISearch search)
Returns a
SearchResult object that includes both the list of
results like search() and the total length like
count() . |
java.lang.Object |
searchUnique(ISearch search)
Search for a single result using the given parameters.
|
<T> T find(java.lang.Class<T> type, java.io.Serializable id)
Get the entity with the specified type and id from the datastore.
If none is found, return null.
<T> T[] find(java.lang.Class<T> type, java.io.Serializable... ids)
<T> T getReference(java.lang.Class<T> type, java.io.Serializable id)
Get a reference to the entity with the specified type and id from the datastore.
This does not require a call to the datastore and does not populate any of the entity's values. Values may be fetched lazily at a later time. This increases performance if a another entity is being saved that should reference this entity but the values of this entity are not needed.
a
- HibernateException if no matching entity is found<T> T[] getReferences(java.lang.Class<T> type, java.io.Serializable... ids)
Get a reference to the entities of the specified type with the given ids from the datastore. An array of entities is returned that matches the same order of the ids listed in the call.
This does not require a call to the datastore and does not populate any of the entities' values. Values may be fetched lazily at a later time. This increases performance if a another entity is being saved that should reference these entities but the values of these entities are not needed.
a
- HibernateException if any of the matching entities are not
found.boolean save(java.lang.Object entity)
If the id of the entity is null or zero, add it to the datastore and assign it an id; otherwise, update the corresponding entity in the datastore with the properties of this entity. In either case the entity passed to this method will be attached to the session.
If an entity to update is already attached to the session, this method will have no effect. If an entity to update has the same id as another instance already attached to the session, an error will be thrown.
true
if create; false
if update.boolean[] save(java.lang.Object... entities)
For each entity, if the id of the entity is null or zero, add it to the datastore and assign it an id; otherwise, update the corresponding entity in the datastore with the properties of this entity. In either case the entity passed to this method will be attached to the session.
If an entity to update is already attached to the session, this method will have no effect. If an entity to update has the same id as another instance already attached to the session, an error will be thrown.
boolean remove(java.lang.Object entity)
true
if the entity is found in the datastore and
removed, false
if it is not found.void remove(java.lang.Object... entities)
boolean removeById(java.lang.Class<?> type, java.io.Serializable id)
true
if the entity is found in the datastore and
removed, false
if it is not found.void removeByIds(java.lang.Class<?> type, java.io.Serializable... ids)
<T> java.util.List<T> findAll(java.lang.Class<T> type)
java.util.List search(ISearch search)
ISearch
object.java.lang.Object searchUnique(ISearch search)
int count(ISearch search)
ISearch
if there were no paging or maxResults limits.SearchResult searchAndCount(ISearch search)
SearchResult
object that includes both the list of
results like search()
and the total length like
count()
.boolean isAttached(java.lang.Object entity)
true
if the object is connected to the current
Hibernate session.void refresh(java.lang.Object... entities)
void flush()
Filter getFilterFromExample(java.lang.Object example)
Filter getFilterFromExample(java.lang.Object example, ExampleOptions options)