|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
org.domdrides.hibernate.repository.HibernateRepository<EntityType,IdType>
@Repository public abstract class HibernateRepository<EntityType extends Entity<IdType>,IdType extends Serializable>
A Hibernate-based repository implementation.
| Field Summary | |
|---|---|
static String |
UNCHECKED
|
| Fields inherited from class org.springframework.dao.support.DaoSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
protected |
HibernateRepository(Class<EntityType> entityClass)
Constructs a repository which supports entityClass. |
| Method Summary | |
|---|---|
EntityType |
add(EntityType entity)
Adds the entity to this repository. |
boolean |
contains(EntityType entity)
Returns whether or not the entity is contained within the repository. |
protected org.hibernate.Criteria |
createCriteria()
Creates a Criteria object which returns the entity type. |
Set<EntityType> |
getAll()
Returns all entities in this repository as a set. |
EntityType |
getById(IdType id)
Returns the entity with the given id. |
protected List<EntityType> |
list(org.hibernate.Criteria criteria)
Returns a list of entities based on the provided criteria. |
List<EntityType> |
list(int first,
int max,
String sortProperty,
boolean ascending)
Returns one page of data from this repository. |
protected List<EntityType> |
list(org.hibernate.Query query)
Returns a list of entities based on the provided query. |
void |
remove(EntityType entity)
Removes the entity from this repository. |
protected Set<EntityType> |
set(org.hibernate.Criteria criteria)
Returns a set of entities based on the provided criteria. |
protected Set<EntityType> |
set(org.hibernate.Query query)
Returns a set of entities based on the provided query. |
int |
size()
Returns the size of the repository. |
protected EntityType |
uniqueResult(org.hibernate.Criteria criteria)
Returns a unique result based on the provided criteria. |
protected EntityType |
uniqueResult(org.hibernate.Query query)
Returns a unique result based on the provided query. |
EntityType |
update(EntityType entity)
Updates an entity within this repository. |
| Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport |
|---|
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
| Methods inherited from class org.springframework.dao.support.DaoSupport |
|---|
afterPropertiesSet, initDao |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String UNCHECKED
| Constructor Detail |
|---|
protected HibernateRepository(Class<EntityType> entityClass)
entityClass.
entityClass - the entity class| Method Detail |
|---|
@Transactional(readOnly=true)
public List<EntityType> list(int first,
int max,
String sortProperty,
boolean ascending)
list in interface PageableRepository<EntityType extends Entity<IdType>,IdType extends Serializable>first - the first entity to returnmax - the maximum number of entities to returnsortProperty - the property to sort byascending - whether or not the sorting is asceding
@Transactional public EntityType add(EntityType entity)
Repository
add in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>entity - the entity
@Transactional(readOnly=true) public boolean contains(EntityType entity)
Repository
contains in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>entity - the entity
@Transactional(readOnly=true) public Set<EntityType> getAll()
Repository
getAll in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>@Transactional(readOnly=true) public EntityType getById(IdType id)
Repository
getById in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>id - the id
@Transactional public void remove(EntityType entity)
Repository
remove in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>entity - the entity@Transactional(readOnly=true) public int size()
Repository
size in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>@Transactional public EntityType update(EntityType entity)
Repository
update in interface Repository<EntityType extends Entity<IdType>,IdType extends Serializable>entity - the entity
protected org.hibernate.Criteria createCriteria()
Criteria object which returns the entity type.
Criteria object which returns the entity type@Transactional(readOnly=true) protected List<EntityType> list(org.hibernate.Criteria criteria)
criteria - the criteria
@Transactional(readOnly=true) protected List<EntityType> list(org.hibernate.Query query)
query - the query
@Transactional(readOnly=true) protected Set<EntityType> set(org.hibernate.Criteria criteria)
criteria - the criteria
@Transactional(readOnly=true) protected Set<EntityType> set(org.hibernate.Query query)
query - the query
@Transactional(readOnly=true) protected EntityType uniqueResult(org.hibernate.Criteria criteria)
criteria - the criteria
@Transactional(readOnly=true) protected EntityType uniqueResult(org.hibernate.Query query)
query - the query
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||