T
- public interface IService<T extends ICdmBase>
Modifier and Type | Method and Description |
---|---|
void |
clear() |
int |
count(java.lang.Class<? extends T> clazz)
Returns a count of all entities of type
|
DeleteResult |
delete(java.util.Collection<java.util.UUID> persistentObjectUUIDs)
Deletes a collection of persistent objects correponding to the
given list of uuids.
|
DeleteResult |
delete(T persistentObject) |
DeleteResult |
delete(java.util.UUID persistentObjectUUID)
Delete an existing persistent object
|
boolean |
exists(java.util.UUID uuid)
Returns true if an entity of type
|
<S extends T> |
find(java.lang.Class<S> clazz,
java.util.Set<java.util.UUID> uuidSet)
Return a list of persisted entities that match the unique identifier
set supplied as an argument and that do match the supplied class.
|
T |
find(int id)
Return a persisted entity that matches the database identifier
supplied as an argument, or null if the entity does not exist
|
java.util.List<T> |
find(java.util.Set<java.util.UUID> uuidSet)
Return a list of persisted entities that match the unique identifier
set supplied as an argument
|
T |
find(java.util.UUID uuid)
Return a persisted entity that matches the unique identifier
supplied as an argument, or null if the entity does not exist
|
java.util.List<T> |
findById(java.util.Set<java.lang.Integer> idSet)
Deprecated.
use
#loadByIds(Set, List) instead |
T |
findWithoutFlush(java.util.UUID uuid)
Return a persisted entity that matches the unique identifier
supplied as an argument, or null if the entity does not exist.
|
org.hibernate.Session |
getSession() |
java.util.List<java.lang.Object[]> |
group(java.lang.Class<? extends T> clazz,
java.lang.Integer limit,
java.lang.Integer start,
java.util.List<Grouping> groups,
java.util.List<java.lang.String> propertyPaths)
Returns a sublist of objects matching the grouping projections supplied using the groups parameter
It would be nice to be able to return a pager, but for the moment hibernate doesn't
seem to support this (HHH-3238 - impossible to get the rowcount for a criteria that has projections)
|
<S extends T> |
list(java.lang.Class<S> type,
java.lang.Integer limit,
java.lang.Integer start,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Returns a list of entities of type
|
<S extends T> |
list(S example,
java.util.Set<java.lang.String> includeProperties,
java.lang.Integer limit,
java.lang.Integer start,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Method that lists the objects matching the example provided.
|
T |
load(int id,
java.util.List<java.lang.String> propertyPaths)
Return a persisted entity that matches the database identifier
supplied as an argument, or null if the entity does not exist
|
java.util.List<T> |
load(java.util.List<java.util.UUID> uuids,
java.util.List<java.lang.String> propertyPaths)
Finds the cdm entities specified by the
uuids ,
recursively initializes all bean properties given in the
propertyPaths parameter and returns the initialised
entity list; |
T |
load(java.util.UUID uuid)
Finds the cdm entity specified by the
uuid parameter and
initializes all its *ToOne relations. |
T |
load(java.util.UUID uuid,
java.util.List<java.lang.String> propertyPaths)
Finds the cdm entity specified by the
uuid parameter and
recursively initializes all bean properties given in the
propertyPaths parameter. |
java.util.List<T> |
loadByIds(java.util.List<java.lang.Integer> idSet,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Loads a batch of entities referenced by their ids.
|
java.util.List<T> |
loadByIds(java.util.List<java.lang.Integer> idSet,
java.util.List<java.lang.String> propertyPaths)
Loads a batch of entities referenced by their ids.
|
T |
loadWithUpdate(java.util.UUID uuid)
Simply calls the load method.
|
void |
lock(T t,
org.hibernate.LockOptions lockOptions)
Obtain the specified lock mode on the given object t
NOTE: with hibernate 4 we changed parameter lockMode to lockOptions. |
java.util.List<T> |
merge(java.util.List<T> detachedObjects)
Merges a list of detached objects and returns the new
list of merged objects
|
java.util.List<MergeResult<T>> |
merge(java.util.List<T> detachedObjects,
boolean returnTransientEntity)
This method allows for the possibility of returning the input transient
entities instead of the merged persistent entity
WARNING : This method should never be used when the objective of the merge
is to attach to an existing session which is the standard use case.
|
T |
merge(T transientObject)
Copy the state of the given object onto the persistent object with the same identifier.
|
MergeResult<T> |
merge(T newInstance,
boolean returnTransientEntity)
This method allows for the possibility of returning the input transient
entity instead of the merged persistent entity
WARNING : This method should never be used when the objective of the merge
is to attach to an existing session which is the standard use case.
|
<S extends T> |
page(java.lang.Class<S> type,
java.lang.Integer pageSize,
java.lang.Integer pageNumber,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths)
Returns a paged list of entities of type
|
<S extends T> |
page(java.lang.Class<S> clazz,
java.util.List<Restriction<?>> restrictions,
java.lang.Integer pageSize,
java.lang.Integer pageIndex,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths) |
<S extends T> |
page(java.lang.Class<S> clazz,
java.lang.String param,
java.lang.String queryString,
MatchMode matchmode,
java.util.List<org.hibernate.criterion.Criterion> criteria,
java.lang.Integer pageSize,
java.lang.Integer pageIndex,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths) |
<S extends T> |
pageByParamWithRestrictions(java.lang.Class<S> clazz,
java.lang.String param,
java.lang.String queryString,
MatchMode matchmode,
java.util.List<Restriction<?>> restrictions,
java.lang.Integer pageSize,
java.lang.Integer pageIndex,
java.util.List<OrderHint> orderHints,
java.util.List<java.lang.String> propertyPaths) |
java.util.UUID |
refresh(T persistentObject)
Re-read the state of the given instance from the underlying database.
|
void |
refresh(T t,
org.hibernate.LockOptions lockOptions,
java.util.List<java.lang.String> propertyPaths)
Refreshes a given object t using the specified lockmode
All bean properties given in the
propertyPaths parameter are recursively initialized. |
java.util.Map<java.util.UUID,T> |
save(java.util.Collection<T> newInstances)
Save a collection containing new entities (persists the entities)
|
T |
save(T newInstance)
Save a new entity (persists the entity)
|
java.util.Map<java.util.UUID,T> |
saveOrUpdate(java.util.Collection<T> transientObjects)
Save new entities or update the persistent state of existing
transient entities that have been persisted previously
|
java.util.UUID |
saveOrUpdate(T transientObject)
Save a new entity or update the persistent state of an existing
transient entity that has been persisted previously
|
java.util.UUID |
update(T transientObject)
Update the persistent state of an existing transient entity
that has been persisted previously
|
void clear()
void lock(T t, org.hibernate.LockOptions lockOptions)
void refresh(T t, org.hibernate.LockOptions lockOptions, java.util.List<java.lang.String> propertyPaths)
propertyPaths
parameter are recursively initialized.
For detailed description and examples please refer to:
IBeanInitializer.initialize(Object, List)
NOTE: in the case of lockmodes that hit the database (e.g. LockMode.READ), you will need to re-initialize
child propertiesto avoid a HibernateLazyInitializationException (even if the properties of the child
were initialized prior to the refresh).
NOTE: with hibernate 4 we changed parameter lockMode to lockOptions. LockOptions can be created from LockMode.
t
- lockOptions
- int count(java.lang.Class<? extends T> clazz)
clazz
- the class of entities to be counted (can be null to count all entities of type DeleteResult delete(java.util.UUID persistentObjectUUID)
persistentObject
- the object to be deletedboolean exists(java.util.UUID uuid)
uuid
- the unique identifier of the entity requiredjava.util.List<T> find(java.util.Set<java.util.UUID> uuidSet)
uuidSet
- the set of unique identifiers of the entities required<S extends T> java.util.List<S> find(java.lang.Class<S> clazz, java.util.Set<java.util.UUID> uuidSet)
uuidSet
- the set of unique identifiers of the entities requiredT find(java.util.UUID uuid)
uuid
- the unique identifier of the entity requirednull
T findWithoutFlush(java.util.UUID uuid)
The difference between this method and find
is
that this method makes the hibernate read query with the
FlushMode
for the session set to 'MANUAL'
WARNING:This method should ONLY be used when it is absolutely
necessary and safe to ensure that the hibernate session is not flushed before a read
query. A use case for this is the CdmCacher
,
(ticket #4276) where a call to load
the CDM Entity using the standard find
method results in recursion
due to the fact that the find
method triggers a hibernate session
flush which eventually could call getNameCache
,
which in turn (in the event that name cache is null) eventually calls the
load
again.
Apart from these kind of exceptional circumstances, the standard find
method should always be used to ensure that the persistence layer is always in sync with the
underlying database.
uuid
- null
T find(int id)
id
- the database identifier of the entity required@Deprecated java.util.List<T> findById(java.util.Set<java.lang.Integer> idSet)
#loadByIds(Set, List)
insteadList
of persisted entities that match the database identifiers.
Returns an empty list if no identifier matches.idSet
- org.hibernate.Session getSession()
java.util.List<java.lang.Object[]> group(java.lang.Class<? extends T> clazz, java.lang.Integer limit, java.lang.Integer start, java.util.List<Grouping> groups, java.util.List<java.lang.String> propertyPaths)
clazz
- Restrict the query to objects of a certain class, or null for all objects of type T or subclasseslimit
- the maximum number of entities returned (can be null to return
all entities)start
- The (0-based) offset from the start of the recordset (can be null, equivalent of starting at the beginning of the recordset)groups
- The grouping objects representing a projection, plus an optional ordering on that projected propertypropertyPaths
- paths initialized on the returned objects - only applied to the objects returned from the first grouping<S extends T> java.util.List<S> list(java.lang.Class<S> type, java.lang.Integer limit, java.lang.Integer start, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
type
- The type of entities to return (can be null to count all entities of type limit
- The maximum number of objects returned (can be null for all matching objects)start
- The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset)orderHints
- Supports path like orderHints.propertyNames
which
include *-to-one properties like createdBy.username or
authorTeam.persistentTitleCachepropertyPaths
- properties to be initializedT load(java.util.UUID uuid)
uuid
parameter and
initializes all its *ToOne relations.uuid
- null
if not object with given uuid exists or uuid is null
T load(int id, java.util.List<java.lang.String> propertyPaths)
id
- the database identifier of the entity requiredpropertyPaths
- T load(java.util.UUID uuid, java.util.List<java.lang.String> propertyPaths)
uuid
parameter and
recursively initializes all bean properties given in the
propertyPaths
parameter.
For detailed description and examples please refer to:
IBeanInitializer.initialize(Object, List)
uuid
- null
if not object with given uuid exists or uuid is null
java.util.List<T> load(java.util.List<java.util.UUID> uuids, java.util.List<java.lang.String> propertyPaths)
uuids
,
recursively initializes all bean properties given in the
propertyPaths
parameter and returns the initialised
entity list;
For detailed description and examples please refer to:
IBeanInitializer.initialize(Object, List)
uuids
- propertyPaths
- T merge(T transientObject)
transientObject
- the entity to be merged<S extends T> Pager<S> page(java.lang.Class<S> type, java.lang.Integer pageSize, java.lang.Integer pageNumber, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
type
- The type of entities to return (can be null to count all entities of type pageSize
- The maximum number of objects returned (can be null for all matching objects)pageNumber
- The offset (in pageSize chunks) from the start of the result set (0 - based,
can be null, equivalent of starting at the beginning of the recordset)orderHints
- Supports path like orderHints.propertyNames
which
include *-to-one properties like createdBy.username or
authorTeam.persistentTitleCachepropertyPaths
- properties to be initializedjava.util.UUID refresh(T persistentObject)
persistentObject
- the object to be refreshedjava.util.Map<java.util.UUID,T> save(java.util.Collection<T> newInstances)
newInstances
- the new entities to be persistedT save(T newInstance)
newInstance
- the new entity to be persistedjava.util.UUID saveOrUpdate(T transientObject)
transientObject
- the entity to be persistedjava.util.Map<java.util.UUID,T> saveOrUpdate(java.util.Collection<T> transientObjects)
transientObjects
- the entities to be persistedjava.util.UUID update(T transientObject)
transientObject
- the entity to be persistedT loadWithUpdate(java.util.UUID uuid)
uuid
- <S extends T> java.util.List<S> list(S example, java.util.Set<java.lang.String> includeProperties, java.lang.Integer limit, java.lang.Integer start, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
example
- includeProperties
- limit
- the maximum number of entities returned (can be null to return
all entities)start
- The (0-based) offset from the start of the recordsetorderHints
- Supports path like orderHints.propertyNames
which
include *-to-one properties like createdBy.username orpropertyPaths
- paths initialized on the returned objects - only applied to the objects returned from the first groupingDeleteResult delete(T persistentObject)
DeleteResult delete(java.util.Collection<java.util.UUID> persistentObjectUUIDs)
persistentObjectUUIDs
- uuids of persistent objects to deletejava.util.List<T> merge(java.util.List<T> detachedObjects)
detachedObjects
- java.util.List<T> loadByIds(java.util.List<java.lang.Integer> idSet, java.util.List<java.lang.String> propertyPaths)
idSet
- propertyPaths
- java.util.List<T> loadByIds(java.util.List<java.lang.Integer> idSet, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
idSet
- orderHints
- propertyPaths
- java.util.List<MergeResult<T>> merge(java.util.List<T> detachedObjects, boolean returnTransientEntity)
PostMergeEntityListener.onMerge(MergeEvent,Map)
making the two objects identical and allowing the transient object to be used further
as a POJOdetachedObjects
- returnTransientEntity
- MergeResult<T> merge(T newInstance, boolean returnTransientEntity)
newInstance
- returnTransientEntity
- <S extends T> Pager<S> page(java.lang.Class<S> clazz, java.lang.String param, java.lang.String queryString, MatchMode matchmode, java.util.List<org.hibernate.criterion.Criterion> criteria, java.lang.Integer pageSize, java.lang.Integer pageIndex, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
<S extends T> Pager<S> pageByParamWithRestrictions(java.lang.Class<S> clazz, java.lang.String param, java.lang.String queryString, MatchMode matchmode, java.util.List<Restriction<?>> restrictions, java.lang.Integer pageSize, java.lang.Integer pageIndex, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
<S extends T> Pager<S> page(java.lang.Class<S> clazz, java.util.List<Restriction<?>> restrictions, java.lang.Integer pageSize, java.lang.Integer pageIndex, java.util.List<OrderHint> orderHints, java.util.List<java.lang.String> propertyPaths)
clazz
- restrictions
- pageSize
- pageIndex
- orderHints
- propertyPaths
- Copyright © 2007-2020 EDIT. All Rights Reserved.