Package org.nuiton.topia.persistence
Class TopiaDAOImpl<E extends TopiaEntity>
java.lang.Object
org.nuiton.topia.persistence.TopiaDAOImpl<E>
- Type Parameters:
E- le type de l'entite
- All Implemented Interfaces:
Iterable<E>,TopiaDAO<E>,TopiaDAODeprecated<E>
- Direct Known Subclasses:
TopiaDAOLegacy
Cette classe permet d'avoir un ensemble de méthode implantée de façon
standard et plus spécifiquement pour Hibernate.
Certains accès à Hibernate sont tout de même fait ici, car on a pris le choix
de se baser entièrement sur hibernate pour la persistence, et il est ainsi
possible d'accèder au meta information hibernate sur les classes lorque l'on
en a besoin.
- Version:
- $Id$
- Author:
- bpoussin <poussin@codelutin.com>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTopiaDAOImpl.FindAllIterator<E extends TopiaEntity,R> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TopiaContextImplementorUnderlying context used by this dao to do actions on db.Type of entity managed by this dao. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTopiaEntityListener(TopiaEntityListener listener) voidaddTopiaEntityVetoable(TopiaEntityVetoable vetoable) voidcomputeAndAddRecordsToPager(String hql, TopiaPagerBean pager, Object... params) Execute the counthqlquery and then synch the pager to this result (says fill thePagerBean.getRecords()field and then adapt the number of pages available and the current number page).longcount()Count the number of existing entities.longcountByQuery(String hql, Object... params) Count the number of entities based on ahql.intcountByQuery(TopiaQuery query) Count the number of entities based onquery.Permet de sauver un object instancié sans le DAO.Construit une nouvelle instance de l'objet géré par ce DAOCette methode appelle fireVetoableCreate et fireOnCreated Si vous la surchargé, faites attention a appeler le super ou a appeler vous aussi ces deux methodes.Crée une requete basé sur l'entité lié au DAO.createQuery(String entityAlias) Crée une requête basé sur l'entité lié au DAO et lui assigne un alias valable dans la requête..createSimpleQuery(String alias) Create the simple hql query for the entity managed by the dao.voidPermet de supprimer une entite.voidPermet de supprimer des entités.booleanexistByProperties(String propertyName, Object propertyValue, Object... others) Check the existence of an entity withpropertyNamewithpropertyValue.booleanexistByQuery(TopiaQuery query) Check the existence of an entity using aquery.booleanexistByTopiaId(String id) Check the existence of an entity with technicalid.booleanexistsByQuery(String hql, Object... params) Check the existence of an entity using ahqlquery.findAll()Gets all entitys of the dao type in db.findAllByProperties(String propertyName, Object value, Object... others) Gets all entities of the dao type matching thevaluefor the givenpropertyNameandothers.findAllByProperties(Map<String, Object> properties) Gets all entities of the dao type matching all theproperties.findAllByProperty(String propertyName, Object value) Gets all entities of the dao type matching thevaluefor the givenpropertyName.<R> List<R>findAllByQuery(Class<R> type, String hql, Object... params) Gets all entities when executing the given select query for the giventypewhich may not be a entity type (int, long, map,...).findAllByQuery(String hql, Object... params) Gets all entities when executing the given select query for the dao entity type.findAllByQuery(TopiaQuery query) Execute une requête basé sur l'entité du DAO.<R> List<R>findAllByQueryAndPager(Class<R> type, String hql, TopiaPagerBean pager, Object... params) Gets a page of entities of the given selecthqlquery using thepagerto obtain the window of entities to return.findAllByQueryAndPager(String hql, TopiaPagerBean pager, Object... params) Gets a page of entities of the given selecthqlquery using thepagerto obtain the window of entities to return.<R> List<R>findAllByQueryWithBound(Class<R> type, String hql, int startIndex, int endIndex, Object... params) Gets a page of entities when executing the given select query for the dao entity type (will only return the window ofstartIndex - endIndexentities).findAllByQueryWithBound(String hql, int startIndex, int endIndex, Object... params) Gets a page of entities when executing the given select query for the dao entity type (will only return the window ofstartIndex - endIndexentities).findAllContains(String propertyName, Object property) Récupère toutes les entités (du type géré par ce dao) dont la collection nomméepropertyNamecontient lapropertydonnée.Recuperation de tous les ids en base pour le type d'entite du dao.findAllLazyByQuery(int batchSize, String hql, Object... params) Gets all entities in lazy mode when executing the given select query for the dao entity type.<R> Iterable<R>findAllLazyByQuery(Class<R> type, int batchSize, String hql, Object... params) Gets all entities in lazy mode when executing the given select query for the giventypewhich may not be a entity type (int, long, map,...).<R> Iterable<R>findAllLazyByQuery(Class<R> type, String hql, Object... params) Gets all entities in lazy mode when executing the given select query for the giventypewhich may not be a entity type (int, long, map,...).findAllLazyByQuery(String hql, Object... params) Gets all entities in lazy mode when executing the given select query for the dao entity type.findAllMappedByQuery(TopiaQuery query) Execute une requête basé sur l'entité du DAO.findAllMappedByQuery(TopiaQuery query, String keyName, Class<K> keyClass) Execute une requête basé sur l'entité du DAO.Map<Class<? extends TopiaEntity>,List<? extends TopiaEntity>> findAllUsages(E e) Find all usages of the givenentity.findAllWithOrder(String... propertyNames) Gets all entites for the dao entity type order by givenpropertyNames.findByPrimaryKey(Object... k) Recherche la classe en utilisant la cle naturelle, si la cle naturelle est composé de plusieurs champs alors les arguments passés doivent être dans l'ordre de declaration dans le fichier de mappingfindByPrimaryKey(Map<String, Object> keys) Recherche la classe en utilisant la cle naturelle, chaque champs de la cle naturelle est une entre de la map passe en argument.findByProperties(String propertyName, Object value, Object... others) findByProperties(Map<String, Object> properties) Find an entity matchingproperties.findByProperty(String propertyName, Object value) Find an entity matchingvaluefor the givenpropertyName.<R> RfindByQuery(Class<R> type, String hql, Object... params) Execute une requête basé sur letypedonné.findByQuery(String hql, Object... params) Execute une requête basé sur l'entité du DAO.findByQuery(TopiaQuery query) Execute une requête basé sur l'entité du DAO.findByTopiaId(String id) Find an entity corresponding to theid.findContains(String propertyName, Object property) Récupère la première entité (du type géré par ce dao) dont la collection nomméepropertyNamecontient lapropertydonnée.<U extends TopiaEntity>
List<U>findUsages(Class<U> type, E e) Find usages of the givenentityin the entities of the giventype.intObtains the batch size used to load data.Return context used by this DAO.Get the type of entity managed by this DAO.protected SerializableRetourne l'id de l'entityprotected SerializableRetourne l'id de l'entity representer comme une mapgetRequestPermission(String topiaId, int actions) Retourne les permissions a verifier pour l'acces a l'entite pour le service Taas.Get the entityEnum of the type of entity managed by this DAO.voidinit(TopiaContextImplementor context, Class<E> entityClass) When TopiaContextImpl create the TopiaDAOHibernate, it must call this method just after.iterator()Create a new instance of managed entity not persisted.voidremoveTopiaEntityListener(TopiaEntityListener listener) voidremoveTopiaEntityVetoable(TopiaEntityVetoable vetoable) voidsetBatchSize(int batchSize) Set a new default batch size.Permet d'ajouter ou de mettre a jour un objet.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
entityClass
Type of entity managed by this dao.- Since:
- ever
-
context
Underlying context used by this dao to do actions on db.- Since:
- ever
-
-
Constructor Details
-
TopiaDAOImpl
public TopiaDAOImpl()
-
-
Method Details
-
getTopiaEntityEnum
Description copied from interface:TopiaDAOGet the entityEnum of the type of entity managed by this DAO.- Specified by:
getTopiaEntityEnumin interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- entity type enum managed by this DAO
-
getEntityClass
Description copied from interface:TopiaDAOGet the type of entity managed by this DAO.- Specified by:
getEntityClassin interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- entity type managed by this DAO
-
getBatchSize
public int getBatchSize()Description copied from interface:TopiaDAOObtains the batch size used to load data. Default value if 1000.- Specified by:
getBatchSizein interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- the batch size.
-
setBatchSize
public void setBatchSize(int batchSize) Description copied from interface:TopiaDAOSet a new default batch size.- Specified by:
setBatchSizein interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
batchSize- new batch size to use when iterating.
-
iterator
- Specified by:
iteratorin interfaceIterable<E extends TopiaEntity>
-
getId
Retourne l'id de l'entity- Parameters:
e- l'entity- Returns:
- l'id de l'entity ou null si pas trouvé
- Throws:
TopiaException- Si une erreur survient durant la recherche
-
getId
Retourne l'id de l'entity representer comme une map- Parameters:
map- l'entity en representation map- Returns:
- l'id de l'entity ou null si pas trouvé
- Throws:
TopiaException- Si une erreur survient durant la recherche
-
init
When TopiaContextImpl create the TopiaDAOHibernate, it must call this method just after.- Specified by:
initin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
entityClass-context- context- Throws:
TopiaException- if any pb while init
-
getContext
Description copied from interface:TopiaDAOReturn context used by this DAO.- Specified by:
getContextin interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- the context.
-
createSimpleQuery
Description copied from interface:TopiaDAOCreate the simple hql query for the entity managed by the dao. A optional alias can be passed:FROM MyEntityImpl myAlias
- Specified by:
createSimpleQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
alias- optional alias to use in query- Returns:
- the hql query
-
newInstance
Description copied from interface:TopiaDAOCreate a new instance of managed entity not persisted.- Specified by:
newInstancein interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- new entity instance
- Throws:
TopiaException- if any pb while creating the entity
-
findUsages
Description copied from interface:TopiaDAOFind usages of the givenentityin the entities of the giventype.- Specified by:
findUsagesin interfaceTopiaDAO<E extends TopiaEntity>- Type Parameters:
U- type of entity to search- Parameters:
type- the type of entity to searche- the entity on which search is done- Returns:
- the list of entities of the given type which uses the given entity
- Throws:
TopiaException- if any problem while getting data
-
findAllUsages
public Map<Class<? extends TopiaEntity>,List<? extends TopiaEntity>> findAllUsages(E e) throws TopiaException Description copied from interface:TopiaDAOFind all usages of the givenentity.- Specified by:
findAllUsagesin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
e- the entity- Returns:
- the dictionnary of usages of the given entities (keys are entity usage container, values are the list of this type of entity to use the given entity).
- Throws:
TopiaException- if any pb while getting data
-
getRequestPermission
Description copied from interface:TopiaDAODeprecatedRetourne les permissions a verifier pour l'acces a l'entite pour le service Taas.- Specified by:
getRequestPermissionin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
topiaId- topiaId d'une entiteactions- encoded actions- Returns:
- la liste des permissions
- Throws:
TopiaException- if any pb while getting datas
-
addTopiaEntityListener
- Specified by:
addTopiaEntityListenerin interfaceTopiaDAO<E extends TopiaEntity>
-
addTopiaEntityVetoable
- Specified by:
addTopiaEntityVetoablein interfaceTopiaDAO<E extends TopiaEntity>
-
removeTopiaEntityListener
- Specified by:
removeTopiaEntityListenerin interfaceTopiaDAO<E extends TopiaEntity>
-
removeTopiaEntityVetoable
- Specified by:
removeTopiaEntityVetoablein interfaceTopiaDAO<E extends TopiaEntity>
-
create
Description copied from interface:TopiaDAOPermet de sauver un object instancié sans le DAO. Utilisé notement dans le cas ou le DAO est situé derriere une couche de webservice et que l'appel à la methodeTopiaDAO.create(Object...)serait trop couteux.- Specified by:
createin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
entity- l'entité instanciée à sauver- Returns:
- l'entité avec son topiaID valorisé
- Throws:
TopiaException- if any pb while creating datas
-
create
Description copied from interface:TopiaDAOConstruit une nouvelle instance de l'objet géré par ce DAO- Specified by:
createin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
properties- la liste des propriétés que doit avoir l'objet créé les arguments vont par paire (propertyName, value)- Returns:
- un nouvel objet
- Throws:
TopiaException- si un problème est rencontré durant l'instanciation
-
create
Cette methode appelle fireVetoableCreate et fireOnCreated Si vous la surchargé, faites attention a appeler le super ou a appeler vous aussi ces deux methodes.- Specified by:
createin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
properties- la liste des propriétés que doit avoir l'objet créé- Returns:
- un nouvel objet
- Throws:
TopiaException- si un problème est rencontré durant l'instanciation
-
update
Description copied from interface:TopiaDAOPermet d'ajouter ou de mettre a jour un objet. Cela permet d'ajouter par exemple un objet provenant d'un autre context mais du meme type de DAO.- Specified by:
updatein interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
e- l'entite a ajouter ou mettre a jour- Returns:
- l'entity passé en paramètre.
- Throws:
TopiaException- if any pb while updating datas
-
delete
Description copied from interface:TopiaDAOPermet de supprimer une entite.- Specified by:
deletein interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
e- l'entite a supprimer- Throws:
TopiaException- if any pb while deleting datas
-
deleteAll
Description copied from interface:TopiaDAOPermet de supprimer des entités.- Specified by:
deleteAllin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
entities- les entités à supprimer- Throws:
TopiaException- if any pb while deleting datas
-
createQuery
Description copied from interface:TopiaDAODeprecatedCrée une requete basé sur l'entité lié au DAO. Résultat attendu : "FROM E"- Specified by:
createQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Returns:
- une nouvelle TopiaQuery vide. (uniquement avec le From sur le type d'entité)
-
createQuery
Description copied from interface:TopiaDAODeprecatedCrée une requête basé sur l'entité lié au DAO et lui assigne un alias valable dans la requête.. Résultat attendu : "FROM E AS entityAlias"- Specified by:
createQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
entityAlias- alias permettant de manipuler l'entité dans la requête- Returns:
- une nouvelle TopiaQuery
-
findByTopiaId
Description copied from interface:TopiaDAOFind an entity corresponding to theid. If theidis null, nothing will be searched.- Specified by:
findByTopiaIdin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
id- topiaId of the entity to found- Returns:
- the entity found or null if not
- Throws:
TopiaException- for Topia errors on query
-
findByProperty
Description copied from interface:TopiaDAOFind an entity matchingvaluefor the givenpropertyName.- Specified by:
findByPropertyin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- property name to filtervalue- value of the property to math- Returns:
- the first entity matching the request
- Throws:
TopiaException
-
findByProperties
public E findByProperties(String propertyName, Object value, Object... others) throws TopiaException - Specified by:
findByPropertiesin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- le nom de la propriétévalue- la valeur à testerothers- les autres proprietes doivent aller par 2 propertyName, value- Returns:
- l'entité trouvé
- Throws:
TopiaException- if any pb while getting datas
-
findByProperties
Description copied from interface:TopiaDAOFind an entity matchingproperties.- Specified by:
findByPropertiesin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
properties- les propriétés à matcher- Returns:
- l'entité trouvé
- Throws:
TopiaException- if any pb while getting datas
-
findByQuery
Description copied from interface:TopiaDAODeprecatedExecute une requête basé sur l'entité du DAO. Permet de récupérer une entité correspondant à la requête.- Specified by:
findByQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
query- la requête- Returns:
- l'entité correspondant à la recherche ou null si aucune entité n'a été trouvée
- Throws:
TopiaException- if any pb while getting datas- See Also:
-
findAll
Description copied from interface:TopiaDAOGets all entitys of the dao type in db.- Specified by:
findAllin interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- all entities of the dao type in db
- Throws:
TopiaException
-
findAllIds
Description copied from interface:TopiaDAORecuperation de tous les ids en base pour le type d'entite du dao.- Specified by:
findAllIdsin interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- la liste de tous les ids
- Throws:
TopiaException- si pb en base
-
findAllByProperty
Description copied from interface:TopiaDAOGets all entities of the dao type matching thevaluefor the givenpropertyName.- Specified by:
findAllByPropertyin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- property name to filtervalue- value to match- Returns:
- matching entities
- Throws:
TopiaException- if any pb while getting datas
-
findAllByProperties
public List<E> findAllByProperties(String propertyName, Object value, Object... others) throws TopiaException Description copied from interface:TopiaDAOGets all entities of the dao type matching thevaluefor the givenpropertyNameandothers.- Specified by:
findAllByPropertiesin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- le nom de la propriétévalue- la valeur à testerothers- les autres proprietes doivent aller par 2 propertyName, value- Returns:
- matching entities
- Throws:
TopiaException- if any pb while getting datas
-
findAllByProperties
Description copied from interface:TopiaDAOGets all entities of the dao type matching all theproperties.- Specified by:
findAllByPropertiesin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
properties- properties to match- Returns:
- matching entities
- Throws:
TopiaException- if any pb while getting datas
-
findAllByQuery
Description copied from interface:TopiaDAODeprecatedExecute une requête basé sur l'entité du DAO. Permet de récupérer une liste d'entités correspondant à la requête.- Specified by:
findAllByQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
query- la requête- Returns:
- la liste d'entités correspondant à la recherche
- Throws:
TopiaException- if any pb while getting datas- See Also:
-
findAllMappedByQuery
Description copied from interface:TopiaDAODeprecatedExecute une requête basé sur l'entité du DAO. Permet de récupérer une map d'entités correspondant à la requête. La clé de la map étant le topiaId de l'entité.- Specified by:
findAllMappedByQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
query- la requête- Returns:
- la map d'entités correspondant à la recherche
- Throws:
TopiaException- if any pb while getting datas- See Also:
-
findAllMappedByQuery
public <K> Map<K,E> findAllMappedByQuery(TopiaQuery query, String keyName, Class<K> keyClass) throws TopiaException Description copied from interface:TopiaDAODeprecatedExecute une requête basé sur l'entité du DAO. Permet de récupérer une map d'entités correspondant à la requête. Le type et le nom de la propriété utilisé comme clé de la map doit être passé en argument.- Specified by:
findAllMappedByQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Type Parameters:
K- type de la clé de la map- Parameters:
query- la requêtekeyName- nom de la propriété de l'entité utilisée comme clékeyClass- type de la propriété de l'entité utilisée comme clé- Returns:
- la map d'entités correspondant à la recherche
- Throws:
TopiaException- if any pb while getting datas- See Also:
-
findAllWithOrder
Description copied from interface:TopiaDAOGets all entites for the dao entity type order by givenpropertyNames. You can add on eachpropertyASCouDESCto fix order way (by default isASC).- Specified by:
findAllWithOrderin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyNames- property names of order to apply- Returns:
- all entities of the dao entity type with given order
- Throws:
TopiaException- if any pb while getting datas
-
findContains
Description copied from interface:TopiaDAORécupère la première entité (du type géré par ce dao) dont la collection nomméepropertyNamecontient lapropertydonnée.- Specified by:
findContainsin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- le nom de la propriétéproperty- la propriété recherchée- Returns:
- la première entité recherchée
- Throws:
TopiaException- pour tout erreur lors de la recherche
-
findAllContains
Description copied from interface:TopiaDAORécupère toutes les entités (du type géré par ce dao) dont la collection nomméepropertyNamecontient lapropertydonnée.- Specified by:
findAllContainsin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- le nom de la propriétéproperty- la propriété recherchée- Returns:
- toutes les entités recherchées
- Throws:
TopiaException- pour tout erreur lors de la recherche
-
existByTopiaId
Description copied from interface:TopiaDAOCheck the existence of an entity with technicalid.- Specified by:
existByTopiaIdin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
id- unique id of the entity to test existence.- Returns:
- true if entity exists, false otherwise
- Throws:
TopiaException- for Topia errors
-
existByProperties
public boolean existByProperties(String propertyName, Object propertyValue, Object... others) throws TopiaException Description copied from interface:TopiaDAOCheck the existence of an entity withpropertyNamewithpropertyValue.othersproperties can be added to test existence.- Specified by:
existByPropertiesin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
propertyName- first property name to test existencepropertyValue- first property value to test existenceothers- altern propertyName and propertyValue- Returns:
- true if entity exists, false otherwise
- Throws:
TopiaException- for Topia errors
-
existByQuery
Description copied from interface:TopiaDAODeprecatedCheck the existence of an entity using aquery.- Specified by:
existByQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
query- query used to test existence- Returns:
- true if entity exists, false otherwise
- Throws:
TopiaException
-
count
Description copied from interface:TopiaDAOCount the number of existing entities.- Specified by:
countin interfaceTopiaDAO<E extends TopiaEntity>- Returns:
- number of total entities
- Throws:
TopiaException- if any pb while getting datas
-
countByQuery
Description copied from interface:TopiaDAODeprecatedCount the number of entities based onquery.- Specified by:
countByQueryin interfaceTopiaDAODeprecated<E extends TopiaEntity>- Parameters:
query- query- Returns:
- number of entities filtered by the query
- Throws:
TopiaException- if any pb while getting datas
-
findByPrimaryKey
Description copied from interface:TopiaDAORecherche la classe en utilisant la cle naturelle, chaque champs de la cle naturelle est une entre de la map passe en argument.- Specified by:
findByPrimaryKeyin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
keys- la liste des champs de la cle naturelle avec leur valeur- Returns:
- l'entite trouvé
- Throws:
TopiaException- if any pb while getting datas
-
findByPrimaryKey
Description copied from interface:TopiaDAORecherche la classe en utilisant la cle naturelle, si la cle naturelle est composé de plusieurs champs alors les arguments passés doivent être dans l'ordre de declaration dans le fichier de mapping- Specified by:
findByPrimaryKeyin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
k- l'objet cle naturelle de la classe- Returns:
- l'entité trouvé
- Throws:
TopiaException- if any pb while getting datas
-
existsByQuery
Description copied from interface:TopiaDAOCheck the existence of an entity using ahqlquery.- Specified by:
existsByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- query used to test existenceparams- params used by the query- Returns:
- true if entity exists, false otherwise
- Throws:
TopiaException
-
countByQuery
Description copied from interface:TopiaDAOCount the number of entities based on ahql.- Specified by:
countByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- hql query to use- Returns:
- number of entities filtered by the query
- Throws:
TopiaException- if any pb while getting datas
-
findByQuery
Description copied from interface:TopiaDAOExecute une requête basé sur l'entité du DAO. Permet de récupérer une entité correspondant à la requête.- Specified by:
findByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- la requête hql à executerparams- les paramètres de la requète- Returns:
- l'entité correspondant à la recherche ou null si aucune entité n'a été trouvée
- Throws:
TopiaException- if any pb while getting datas
-
findByQuery
Description copied from interface:TopiaDAOExecute une requête basé sur letypedonné. Permet de récupérer une entité correspondant à la requête.- Specified by:
findByQueryin interfaceTopiaDAO<E extends TopiaEntity>hql- la requête hql à executerparams- les paramètres de la requète- Returns:
- l'entité correspondant à la recherche ou null si aucune entité n'a été trouvée
- Throws:
TopiaException- if any pb while getting datas
-
findAllByQuery
Description copied from interface:TopiaDAOGets all entities when executing the given select query for the dao entity type.- Specified by:
findAllByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- hql queryparams- query params- Returns:
- entites of the query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllByQuery
public <R> List<R> findAllByQuery(Class<R> type, String hql, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets all entities when executing the given select query for the giventypewhich may not be a entity type (int, long, map,...).- Specified by:
findAllByQueryin interfaceTopiaDAO<E extends TopiaEntity>hql- hql queryparams- query params- Returns:
- entites of the query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllLazyByQuery
Description copied from interface:TopiaDAOGets all entities in lazy mode when executing the given select query for the dao entity type. Important note:- Specified by:
findAllLazyByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- hql queryparams- query params- Returns:
- entites of the query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllLazyByQuery
public <R> Iterable<R> findAllLazyByQuery(Class<R> type, String hql, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets all entities in lazy mode when executing the given select query for the giventypewhich may not be a entity type (int, long, map,...). Important note:- Specified by:
findAllLazyByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
type- type of data to returnhql- hql queryparams- query params- Returns:
- entites of the query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllLazyByQuery
public Iterable<E> findAllLazyByQuery(int batchSize, String hql, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets all entities in lazy mode when executing the given select query for the dao entity type. Important note:- Specified by:
findAllLazyByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
batchSize- batch sizehql- hql queryparams- query params- Returns:
- entites of the query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllLazyByQuery
public <R> Iterable<R> findAllLazyByQuery(Class<R> type, int batchSize, String hql, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets all entities in lazy mode when executing the given select query for the giventypewhich may not be a entity type (int, long, map,...). Important note:- Specified by:
findAllLazyByQueryin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
type- type of data to returnbatchSize- batch sizehql- hql queryparams- query params- Returns:
- entites of the query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllByQueryWithBound
public <R> List<R> findAllByQueryWithBound(Class<R> type, String hql, int startIndex, int endIndex, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets a page of entities when executing the given select query for the dao entity type (will only return the window ofstartIndex - endIndexentities).- Specified by:
findAllByQueryWithBoundin interfaceTopiaDAO<E extends TopiaEntity>hql- hql query to executestartIndex- first index of entity to returnendIndex- last index of entity to returnparams- query params- Returns:
- entites of the paginated query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllByQueryWithBound
public List<E> findAllByQueryWithBound(String hql, int startIndex, int endIndex, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets a page of entities when executing the given select query for the dao entity type (will only return the window ofstartIndex - endIndexentities).- Specified by:
findAllByQueryWithBoundin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- hql query to executestartIndex- first index of entity to returnendIndex- last index of entity to returnparams- query params- Returns:
- entites of the paginated query result
- Throws:
TopiaException- if any pb while getting datas
-
findAllByQueryAndPager
public <R> List<R> findAllByQueryAndPager(Class<R> type, String hql, TopiaPagerBean pager, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets a page of entities of the given selecthqlquery using thepagerto obtain the window of entities to return.- Specified by:
findAllByQueryAndPagerin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
type- type of data to returnhql- hql query to executepager- pager to obtan the correct window of dataparams- params of the query- Returns:
- entities of the paginated query result
- Throws:
TopiaException- if any pb while getting datas- See Also:
-
findAllByQueryAndPager
public List<E> findAllByQueryAndPager(String hql, TopiaPagerBean pager, Object... params) throws TopiaException Description copied from interface:TopiaDAOGets a page of entities of the given selecthqlquery using thepagerto obtain the window of entities to return.- Specified by:
findAllByQueryAndPagerin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- hql query to executepager- pager to obtan the correct window of dataparams- params of the query- Returns:
- entities of the paginated query result
- Throws:
TopiaException- if any pb while getting datas- See Also:
-
computeAndAddRecordsToPager
public void computeAndAddRecordsToPager(String hql, TopiaPagerBean pager, Object... params) throws TopiaException Description copied from interface:TopiaDAOExecute the counthqlquery and then synch the pager to this result (says fill thePagerBean.getRecords()field and then adapt the number of pages available and the current number page).- Specified by:
computeAndAddRecordsToPagerin interfaceTopiaDAO<E extends TopiaEntity>- Parameters:
hql- the count hql to executepager- the page to synchparams- params of the count query- Throws:
TopiaException- if any pb while getting datas- See Also:
-