T - the generic typepublic abstract class AbstractPersistence<T> extends Object implements DaoUpdater<T>, DaoViewer<T>, JavaPersistenceHandler<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractPersistence.SQL_ORDER
The Enum SQL_ORDER.
|
| Modifier and Type | Field and Description |
|---|---|
String |
AND |
protected javax.persistence.EntityManagerFactory |
entityManagerFactory |
protected org.slf4j.Logger |
logger |
protected String |
tableName |
| Modifier and Type | Method and Description |
|---|---|
int |
countItems()
Count items.
|
boolean |
create(T item)
Creates the.
|
javax.persistence.EntityManager |
createNewManager()
Creates the new manager.
|
abstract int |
deleteItemByIdField(String idField)
Delete item by id field.
|
int |
deleteItemByInternalId(int internalId)
Delete item by internal id.
|
List<T> |
executeCriteriaQuery(javax.persistence.criteria.CriteriaQuery<Object> criteriaQuery)
Execute criteria query.
|
List<T> |
executeTypedQuery(javax.persistence.criteria.CriteriaQuery<Object> cq,
int startIndex,
int offset)
Execute typed query.
|
javax.persistence.criteria.CriteriaBuilder |
getCriteriaBuilder()
Gets the criteria builder.
|
javax.persistence.EntityManagerFactory |
getEntityManagerFactory()
Gets the entity manager factory.
|
T |
getItemByKey(Integer id,
Class<T> t)
Gets the item by key.
|
List<T> |
getRows()
Gets the rows.
|
List<T> |
getRows(int startIndex,
int offset)
Gets the rows.
|
List<T> |
getRowsFiltered(Map<String,String> andFilterMap)
Gets the rows filtered.
|
List<T> |
getRowsOrdered(String orderByField,
AbstractPersistence.SQL_ORDER order)
Gets the rows ordered.
|
boolean |
insert(T item)
Insert.
|
boolean |
remove(T item,
boolean transaction)
Removes the.
|
int |
removeAll()
Removes the all.
|
abstract int |
removeAllReleations()
Removes the all releations.
|
abstract int |
removeRelations(T item)
Removes the relations.
|
abstract javax.persistence.criteria.Root<T> |
rootFrom(javax.persistence.criteria.CriteriaQuery<Object> cq)
Root from.
|
T |
update(T item)
Update.
|
protected javax.persistence.EntityManagerFactory entityManagerFactory
public final String AND
protected org.slf4j.Logger logger
protected String tableName
public boolean create(T item) throws DatabaseServiceException
DaoUpdatercreate in interface DaoUpdater<T>item - the itemDatabaseServiceException - the database service exceptionpublic boolean insert(T item) throws DatabaseServiceException
DaoUpdaterinsert in interface DaoUpdater<T>item - the itemDatabaseServiceException - the database service exceptionpublic T update(T item) throws DatabaseServiceException
DaoUpdaterupdate in interface DaoUpdater<T>item - the itemDatabaseServiceException - the database service exceptionpublic boolean remove(T item, boolean transaction) throws DatabaseServiceException
DaoUpdaterremove in interface DaoUpdater<T>item - the itemtransaction - the transactionDatabaseServiceException - the database service exceptionpublic List<T> getRows() throws DatabaseServiceException
DaoViewergetRows in interface DaoViewer<T>DatabaseServiceException - the database service exceptionpublic List<T> getRowsOrdered(String orderByField, AbstractPersistence.SQL_ORDER order) throws DatabaseServiceException
DaoViewergetRowsOrdered in interface DaoViewer<T>orderByField - the order by fieldorder - the orderDatabaseServiceException - the database service exceptionpublic List<T> getRows(int startIndex, int offset) throws DatabaseServiceException
DaoViewergetRows in interface DaoViewer<T>startIndex - the start indexoffset - the offsetDatabaseServiceException - the database service exceptionpublic int countItems()
throws DatabaseServiceException
DaoViewercountItems in interface DaoViewer<T>DatabaseServiceException - the database service exceptionpublic List<T> getRowsFiltered(Map<String,String> andFilterMap) throws DatabaseServiceException
DaoViewergetRowsFiltered in interface DaoViewer<T>andFilterMap - the filter mapDatabaseServiceException - the database service exceptionpublic int removeAll()
throws DatabaseServiceException
DaoUpdaterremoveAll in interface DaoUpdater<T>DatabaseServiceException - the database service exceptionpublic T getItemByKey(Integer id, Class<T> t) throws DatabaseServiceException
DaoViewergetItemByKey in interface DaoViewer<T>id - the idt - the tDatabaseServiceException - the database service exceptionpublic javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
throws DatabaseServiceException
JavaPersistenceHandlergetCriteriaBuilder in interface JavaPersistenceHandler<T>DatabaseServiceException - the database service exceptionpublic javax.persistence.EntityManagerFactory getEntityManagerFactory()
JavaPersistenceHandlergetEntityManagerFactory in interface JavaPersistenceHandler<T>public javax.persistence.EntityManager createNewManager()
throws DatabaseServiceException
JavaPersistenceHandlercreateNewManager in interface JavaPersistenceHandler<T>DatabaseServiceException - the database service exceptionpublic List<T> executeCriteriaQuery(javax.persistence.criteria.CriteriaQuery<Object> criteriaQuery) throws DatabaseServiceException
JavaPersistenceHandlerexecuteCriteriaQuery in interface JavaPersistenceHandler<T>criteriaQuery - the criteria queryDatabaseServiceException - the database service exceptionpublic List<T> executeTypedQuery(javax.persistence.criteria.CriteriaQuery<Object> cq, int startIndex, int offset) throws DatabaseServiceException
JavaPersistenceHandlerexecuteTypedQuery in interface JavaPersistenceHandler<T>cq - the cqstartIndex - the start indexoffset - the offsetDatabaseServiceException - the database service exceptionpublic int deleteItemByInternalId(int internalId)
throws DatabaseServiceException
DaoUpdaterdeleteItemByInternalId in interface DaoUpdater<T>internalId - the internal idDatabaseServiceException - the database service exceptionpublic abstract javax.persistence.criteria.Root<T> rootFrom(javax.persistence.criteria.CriteriaQuery<Object> cq)
JavaPersistenceHandlerrootFrom in interface JavaPersistenceHandler<T>cq - the cqpublic abstract int deleteItemByIdField(String idField) throws DatabaseServiceException
DaoUpdaterdeleteItemByIdField in interface DaoUpdater<T>idField - the id fieldDatabaseServiceException - the database service exceptionpublic abstract int removeAllReleations()
public abstract int removeRelations(T item)
item - the itemCopyright © 2015. All Rights Reserved.