|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.googlecode.jbp.jpa.AbstractJpaRepository<ID,DomainModel,PersistenceModel>
ID - The class of the identifier.DomainModel - The domain interface of the persisted classes.PersistenceModel - The persisted class, which implements the domain interface.public abstract class AbstractJpaRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>,PersistenceModel extends DomainModel>
Abstract data access object implemented using Hibernate. This abstract class should be extended by specific data access objects when Hibernate is to be used for persistence.
Note that @Transactional annotations are used here as Hibernate
works with object graphs, thus multiple rows in multiple tables may be
modified in a single method. Nevertheless don't forget that normally
transaction should always be declared in the service layer.
| Constructor Summary | |
|---|---|
AbstractJpaRepository(javax.persistence.EntityManager entityManagerParam,
IGenericRepository genericRepositoryParam)
Constructor |
|
| Method Summary | ||
|---|---|---|
protected javax.persistence.TypedQuery |
addPagingToQuery(javax.persistence.TypedQuery queryParam,
Page pageParam)
Adds the specified paging to the specified criteria. |
|
DomainModel |
create(DomainModel entity)
|
|
protected
|
createCriteria(Class<DomainModel> persistentClassParam)
Creates a criteria with the persisted entity's class. |
|
void |
delete(Collection<DomainModel> entities)
|
|
void |
delete(DomainModel entity)
|
|
void |
delete(ID id)
|
|
void |
deleteAll()
|
|
boolean |
exists(DomainModel entity)
|
|
boolean |
exists(ID id)
|
|
void |
flush()
Flushes the current Hibernate session. |
|
protected abstract Class<PersistenceModel> |
getPersistentClass()
Returns the class of the entities managed using this data access object. |
|
List<DomainModel> |
retrieveAll()
|
|
List<DomainModel> |
retrieveAll(Page pageParam)
|
|
DomainModel |
retrieveById(ID id)
|
|
void |
update(Collection<DomainModel> entities)
|
|
void |
update(DomainModel entity)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractJpaRepository(javax.persistence.EntityManager entityManagerParam,
IGenericRepository genericRepositoryParam)
entityManagerParam - The JPA entity manager that this data access object
uses.genericRepositoryParam - | Method Detail |
|---|
public final DomainModel create(DomainModel entity)
create in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>protected final <ID extends Serializable,DomainModel extends IIdentifiable<ID>> javax.persistence.criteria.CriteriaQuery<DomainModel> createCriteria(Class<DomainModel> persistentClassParam)
public void delete(Collection<DomainModel> entities)
delete in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public void delete(DomainModel entity)
delete in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public void delete(ID id)
delete in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public void deleteAll()
deleteAll in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public boolean exists(DomainModel entity)
exists in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public boolean exists(ID id)
exists in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public final void flush()
protected abstract Class<PersistenceModel> getPersistentClass()
public List<DomainModel> retrieveAll()
retrieveAll in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public List<DomainModel> retrieveAll(Page pageParam)
retrieveAll in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>
protected final javax.persistence.TypedQuery addPagingToQuery(javax.persistence.TypedQuery queryParam,
Page pageParam)
queryParam - The query whose results must be paged.pageParam - The paging setting.
public DomainModel retrieveById(ID id)
retrieveById in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public void update(Collection<DomainModel> entities)
update in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>public void update(DomainModel entity)
update in interface IRepository<ID extends Serializable,DomainModel extends IIdentifiable<ID>>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||