public class HibernateTopiaJpaSupport extends Object implements TopiaJpaSupport
| Modifier and Type | Field and Description |
|---|---|
protected TopiaFiresSupport |
firesSupport |
protected TopiaHibernateSupport |
hibernateSupport |
protected boolean |
useFlushMode
This flag permits to use (or not) the flush mode when doing queries.
|
| Constructor and Description |
|---|
HibernateTopiaJpaSupport(TopiaHibernateSupport hibernateSupport,
TopiaFiresSupport firesSupport) |
| Modifier and Type | Method and Description |
|---|---|
void |
delete(Object object)
Remove a persistent instance.
|
int |
execute(String jpaql,
Map<String,Object> parameters)
Execute JPA-QL operation on data (Update, Delete).
|
<T> List<T> |
find(String jpaql,
int startIndex,
int endIndex,
Map<String,Object> parameters)
Allow to do some JPA-QL query using the given bounds.
|
<T> List<T> |
findAll(String jpaql,
Map<String,Object> parameters)
Allow to do some JPA-QL query
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntity
|
<T> T |
findUnique(String jpaql,
Map<String,Object> parameters)
Allow to do some JPA-QL query and return an unique result.
|
TopiaHibernateSupport |
getHibernateSupport() |
protected org.hibernate.Query |
prepareQuery(String jpaql,
Map<String,Object> parameters) |
void |
save(Object object)
Persist the given transient instance, first assigning a generated identifier.
|
void |
saveOrUpdate(Object object)
Either
TopiaJpaSupport.save(Object) or TopiaJpaSupport.update(Object) the given instance. |
void |
setUseFlushMode(boolean useFlushMode)
Tells to the context if it has to use a flush mode before each query.
|
void |
update(Object object)
Update the persistent instance with the identifier of the given detached instance.
|
protected TopiaHibernateSupport hibernateSupport
protected TopiaFiresSupport firesSupport
protected boolean useFlushMode
true), in that case whebn doing queries (says in method
#findAll(String, Map) or #find(String, int, int, Map) )
it will use the flush mode FlushMode.AUTO).
But sometimes, when doing a lot of queries (for some imports for example),
we do NOT want the session to be flushed each time we do a find, then you
can set this flag to false using the method setUseFlushMode(boolean)public HibernateTopiaJpaSupport(TopiaHibernateSupport hibernateSupport, TopiaFiresSupport firesSupport)
public TopiaHibernateSupport getHibernateSupport()
public void setUseFlushMode(boolean useFlushMode)
TopiaJpaSupportfalse.setUseFlushMode in interface TopiaJpaSupportuseFlushMode - the new value to setprotected org.hibernate.Query prepareQuery(String jpaql, Map<String,Object> parameters)
public <T> List<T> findAll(String jpaql, Map<String,Object> parameters)
TopiaJpaSupportfindAll in interface TopiaJpaSupportjpaql - the JPA-QL queryparameters - a map which keys are the attribute names and values are the attributes expected valuespublic <T> T findUnique(String jpaql, Map<String,Object> parameters)
TopiaJpaSupportfindUnique in interface TopiaJpaSupportjpaql - the JPA-QL queryparameters - a map which keys are the attribute names and values are the attributes expected valuespublic <T> List<T> find(String jpaql, int startIndex, int endIndex, Map<String,Object> parameters)
TopiaJpaSupportstartIndex = 0.endIndex = -1.
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntityfind in interface TopiaJpaSupportjpaql - the JPA-QL querystartIndex - first index of entity to returnendIndex - last index of entity to returnparameters - a map which keys are the attribute names and values are the attributes expected valuespublic int execute(String jpaql, Map<String,Object> parameters)
TopiaJpaSupportexecute in interface TopiaJpaSupportjpaql - the JPA-QL queryparameters - a map which keys are the attribute names and values are the attributes expected valuespublic void save(Object object)
TopiaJpaSupportsave in interface TopiaJpaSupportobject - a transient instance of a persistent classpublic void update(Object object)
TopiaJpaSupportupdate in interface TopiaJpaSupportobject - a detached instance containing updated statepublic void saveOrUpdate(Object object)
TopiaJpaSupportTopiaJpaSupport.save(Object) or TopiaJpaSupport.update(Object) the given instance.
This method is "inspired" of the Hibernate's Session#saveOrUpdate method.saveOrUpdate in interface TopiaJpaSupportobject - a transient or detached instance containing new or updated stateTopiaJpaSupport.save(java.lang.Object),
TopiaJpaSupport.update(Object object)public void delete(Object object)
TopiaJpaSupportdelete in interface TopiaJpaSupportobject - the instance to be removedCopyright © 2004–2013 CodeLutin. All rights reserved.