public class HibGenericDaoImpl extends com.jamasoftware.contour.data.ContourHibernateDaoSupport implements GenericDao
Constructor and Description |
---|
HibGenericDaoImpl() |
Modifier and Type | Method and Description |
---|---|
void |
attachObject(Object obj)
If the underlying ORM supports object caching, this method makes sure this object is cached and associated with
the current session.
|
void |
clearObjectCache()
If the underlying ORM supports object caching, this method clears that cache, forcing any future object retrieval
to come fresh from the database.
|
int |
count(Class<? extends DomainObjectBase> cls,
Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions)
Counts the number of results, given the restrictions, in an efficient manner.
|
void |
deleteAll(List<? extends DomainObjectBase> objectsToDelete) |
void |
detatchObject(Object obj)
If the underlying ORM supports object caching, this method makes sure this object isn't cached, and therefore
isn't returned by any service methods without retrieving from the database fresh.
|
String |
doNotFlushTemporarily()
Sets up the current session to never flush unless explicitly asked via
GenericDao.flush() . |
void |
doWork(org.hibernate.jdbc.Work work) |
void |
flush()
Makes sure that any pending changes or commands to be applied to the database are run or executed.
|
<T extends DomainObjectBase> |
getAllObjects(Class<T> cls)
Gets the entire list of objects of the given class
|
List<Integer> |
getIdsOfReferencesToScope(com.jamasoftware.contour.api.service.delete.DomainEntityList<? extends DomainObjectBase> entityList,
Class<? extends ScopedObject> mappingClass) |
<T extends DomainObjectBase> |
getObject(Class<T> cls,
Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions) |
<T extends DomainObjectBase> |
getObject(Class<T> cls,
Serializable id)
Gets an object by its unique identifier.
|
DomainObjectBase |
getObjectByScopeRef(Integer scope,
Integer refId)
Gets an object by scope/ref
|
List<DomainObjectBase> |
getObjectListByScopeRef(Integer scopeId,
List<Integer> refIds) |
<T extends DomainObjectBase> |
getObjects(Class<T> cls,
Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions)
Gets all the objects of the given type/class that match the given reastrictions
|
<T extends DomainObjectBase> |
getObjects(Class<T> cls,
Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions,
Integer firstResult,
Integer maxResults,
SorterInfo sortInfo)
Gets a
List of objects of type T. |
<T extends DomainObjectBase> |
getObjectsByIds(Class<T> cls,
List<Integer> ids) |
<T extends ScopedObject> |
getScopedObjects(Class<T> cls,
Integer scopeId,
Integer refId) |
void |
initialize(Object proxy)
Force initialization of a proxy object.
|
void |
makeReadOnly(Object obj,
boolean readonly)
If readOnly is true, makes the object read only from the view of the underlying ORM.
|
Object |
mergeObject(Object obj) |
<T extends DomainObjectBase> |
objectExists(Class<T> cls,
Serializable id)
Returns whether or not an object exists.
|
void |
quickFlush()
Performs a quick session flush to persist items in database.
|
<T extends DomainObjectBase> |
remove(Class<T> cls,
Serializable id) |
void |
resumeNormalFlushOperation(String flushModeName)
Expected parameter is that which is returned from
GenericDao.doNotFlushTemporarily() . |
void |
saveOrUpdateObject(Object object) |
void |
setDomainClassMapping(DomainClassMapping domainClassMapping) |
void |
setIndexer(com.jamasoftware.contour.data.util.search.indexer.Indexer indexer) |
void |
updateObjectRefForScope(Integer scope,
Integer oldRefId,
Integer newRefId,
boolean flush)
Performs an update for all scope/ref combinations pointing to the oldRefId to point
to the newRefId
|
distinctResults, doWithQuery, findQueryStringParams, findQueryStringParams, findQueryStringParamsWithSingleList, findQueryStringParamsWithTwoLists, getCount, getDomainObject, getDomainObjects, getDomainObjects, getMaxInCollectionSize, setMaxInCollectionSize, setParameterMapOnQuery, uniqueResult
public List<Integer> getIdsOfReferencesToScope(com.jamasoftware.contour.api.service.delete.DomainEntityList<? extends DomainObjectBase> entityList, Class<? extends ScopedObject> mappingClass)
getIdsOfReferencesToScope
in interface GenericDao
public void quickFlush()
GenericDao
GenericDao.flush()
because it does not flush to
indexes.public void flush()
GenericDao
public String doNotFlushTemporarily()
GenericDao
GenericDao.flush()
.GenericDao.resumeNormalFlushOperation(String)
when done with manual flush modepublic void resumeNormalFlushOperation(String flushModeName)
GenericDao
GenericDao.doNotFlushTemporarily()
. This will revert the current
session back to the flush mode that was set before that call was made.flushModeName
- The flush mode returned from GenericDao.doNotFlushTemporarily()
public void detatchObject(Object obj)
GenericDao
obj
- The object that should not be cached.public void attachObject(Object obj)
GenericDao
obj
- The object that should be associated with the current sessionpublic void makeReadOnly(Object obj, boolean readonly)
GenericDao
obj
- An object to make read only or notreadonly
- Whether the object should be readonly or notpublic void clearObjectCache()
GenericDao
public int count(Class<? extends DomainObjectBase> cls, Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions)
GenericDao
GenericDao.getObjects(Class, java.util.Collection, Integer, Integer, SorterInfo)
when paging information isn't applied, with the same
class and collection of restrictions.cls
- The mapping class that the restrictions apply torestrictions
- The collection of Restriction
s, or nullGenericDao.getObjects(Class, java.util.Collection, Integer, Integer, SorterInfo)
public <T extends DomainObjectBase> T getObject(Class<T> cls, Serializable id)
GenericDao
getObject
in interface GenericDao
public <T extends DomainObjectBase> List<T> getObjectsByIds(Class<T> cls, List<Integer> ids)
getObjectsByIds
in interface GenericDao
public <T extends DomainObjectBase> void remove(Class<T> cls, Serializable id)
remove
in interface GenericDao
public <T extends ScopedObject> List<T> getScopedObjects(Class<T> cls, Integer scopeId, Integer refId)
public DomainObjectBase getObjectByScopeRef(Integer scope, Integer refId)
GenericDao
getObjectByScopeRef
in interface GenericDao
scope
- A scope integerrefId
- The referenced idpublic void updateObjectRefForScope(Integer scope, Integer oldRefId, Integer newRefId, boolean flush)
GenericDao
scope
- A scopeoldRefId
- A refId to update fromnewRefId
- A refId to update toflush
- Whether to flush after update statements are performed. This is recommended, as the
update statements don't bring objects in memory, so one could get stale data if later querying
for data that these updates affected.public <T extends DomainObjectBase> boolean objectExists(Class<T> cls, Serializable id)
GenericDao
T
- The type of the objectcls
- The class of persisted objectid
- The idpublic <T extends DomainObjectBase> List<? extends T> getObjects(Class<T> cls, Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions, Integer firstResult, Integer maxResults, SorterInfo sortInfo)
GenericDao
List
of objects of type T.T
- The type of objects being returnedcls
- The mapping class for the object typerestrictions
- The collection of Restriction
s, or nullfirstResult
- The index of the first result to return (null returns beginning of list)maxResults
- The maximum number of results to return (null for all results)sortInfo
- The sorting information, if applicablepublic void saveOrUpdateObject(Object object)
public List<DomainObjectBase> getObjectListByScopeRef(Integer scopeId, List<Integer> refIds)
public void initialize(Object proxy)
GenericDao
public <T extends DomainObjectBase> T getObject(Class<T> cls, Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions)
public <T extends DomainObjectBase> List<? extends T> getAllObjects(Class<T> cls)
GenericDao
T
- The type of objectscls
- The mapping classpublic <T extends DomainObjectBase> List<? extends T> getObjects(Class<T> cls, Collection<com.jamasoftware.contour.data.service.restriction.Restriction> restrictions)
GenericDao
T
- The typecls
- The mapping classrestrictions
- The restrictions to applypublic void doWork(org.hibernate.jdbc.Work work)
public void deleteAll(List<? extends DomainObjectBase> objectsToDelete)
deleteAll
in interface GenericDao
public void setDomainClassMapping(DomainClassMapping domainClassMapping)
public void setIndexer(com.jamasoftware.contour.data.util.search.indexer.Indexer indexer)
Copyright (c) 2013-2014 Jama Software, Inc. All Rights Reserved.