public class EventsDaoImpl<E extends AbstractEvent> extends AbstractQueryableDaoImpl<E> implements EventsDao<E>
AbstractQueryableDaoImpl
for Event
Sample Dao Service over base service, that fetches all events occuring within a year:public List
query(Integer year) throws Exception { Event e = new Event(); e.setStartDate(dateFormat.parse(year + "/01/01")); e.setEndDate(dateFormat.parse(year + "/12/31")); Query query = new Query (e); query.setOrderString("startDate"); return service.query(query); }
em
ct, t
Constructor and Description |
---|
EventsDaoImpl() |
Modifier and Type | Method and Description |
---|---|
protected String |
conditionConstruct(String name,
Object value,
Field f,
Map<String,Object[]> querableFieldNames)
Construct the Where clause of the Query.
|
void |
delete(E persistentObject) |
Long |
delete(Long id)
A special Delete operation on the entity that will remove the entity and related entities based on id.
|
E |
load(Object id) |
E |
load(Object id,
Class entityClass)
In some situations the DAO represents an Interface or perhaps a parent of the actual Entity./
The exact type of the entity would have to be Supplied.
|
List |
query(String ql,
String dialect,
Object... params)
Execute a raw Query in the native implementation language.
|
Page |
query(String ql,
String dialect,
PageInfo pageInfo,
Object... params)
Execute a raw Query in the native implementation language.
|
E |
save(E transientObject) |
count, ensureRowIsEntity, ensureRowIsEntity, getEntityInstance, getQueryObject, query, query, queryPage, queryPage
getEntityManager, getNativeEntityName, paginate, setEntityManager, update
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
count, getEntityInstance, query, query, queryPage, queryPage
protected String conditionConstruct(String name, Object value, Field f, Map<String,Object[]> querableFieldNames)
AbstractQueryableDaoImpl
Queryable
annotation is defined.conditionConstruct
in class AbstractQueryableDaoImpl<E extends AbstractEvent>
name
- as Stringvalue
- as the Value (for the criteria) for the field namef
- as Field
querableFieldNames
- as Map of String Object[]@Transactional(readOnly=false) public void delete(E persistentObject)
delete
in interface GenericDao<E extends AbstractEvent>
delete
in class GenericDaoImpl<E extends AbstractEvent>
@Transactional(readOnly=true) public E load(Object id, Class entityClass)
GenericDao
load
in interface GenericDao<E extends AbstractEvent>
load
in class GenericDaoImpl<E extends AbstractEvent>
id
- as Id for EntityentityClass
- as Class
of entity@Transactional(readOnly=true) public E load(Object id)
load
in interface GenericDao<E extends AbstractEvent>
load
in class GenericDaoImpl<E extends AbstractEvent>
@Transactional(readOnly=false) public E save(E transientObject)
save
in interface GenericDao<E extends AbstractEvent>
save
in class GenericDaoImpl<E extends AbstractEvent>
@Transactional(readOnly=false) public Long delete(Long id)
GenericDao
delete
in interface GenericDao<E extends AbstractEvent>
delete
in class GenericDaoImpl<E extends AbstractEvent>
Long
@Transactional(readOnly=true) public List query(String ql, String dialect, Object... params) throws Exception
GenericDaoImpl
query
in interface FreeQuery
query
in class GenericDaoImpl<E extends AbstractEvent>
ql
- as String in native Schema languagedialect
- as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.params
- as Query parameters to the string.
List
Exception
@Transactional(readOnly=true) public Page query(String ql, String dialect, PageInfo pageInfo, Object... params) throws Exception
GenericDaoImpl
query
in interface FreeQuery
query
in class GenericDaoImpl<E extends AbstractEvent>
ql
- as String in native Schema languagedialect
- as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.pageInfo
- as PageInfo
for pagination of resultparams
- as Query parameters to the string
Page
Exception
Copyright © 2018. All rights reserved.