nl.surfnet.coin.shared.service
Class GenericServiceHibernateImpl<T extends DomainObject>

java.lang.Object
  extended by nl.surfnet.coin.shared.service.GenericServiceHibernateImpl<T>
All Implemented Interfaces:
GenericService<T>

@Transactional
public class GenericServiceHibernateImpl<T extends DomainObject>
extends Object
implements GenericService<T>

GenericService based on hibernate


Constructor Summary
GenericServiceHibernateImpl(Class<T> type)
          Constructor
 
Method Summary
 org.hibernate.Criteria createCriteria()
           
 void delete(T o)
           
 void detachFromSession(T o)
           
 List<T> findAll()
           
protected  List<T> findByCriteria(org.hibernate.criterion.Criterion... criterion)
          Convenience method for subclasses to find domain objects that match the Criterion's
protected  List<T> findByCriteriaOrdered(List<org.hibernate.criterion.Criterion> criterionList, List<org.hibernate.criterion.Order> orderList)
          Convenicence method for subclasses to find domain objects that match the list of Criterion's in the given order
 List<T> findByExample(T exampleInstance)
           
 List<T> findByExample(T exampleInstance, String[] excludes)
           
 T findById(Long id)
          Find by primary key
 int getCount()
           
 Class<T> getPersistentClass()
           
protected  org.hibernate.classic.Session getSession()
           
 void saveOrUpdate(Collection<T> coll)
           
 Long saveOrUpdate(T t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericServiceHibernateImpl

public GenericServiceHibernateImpl(Class<T> type)
Constructor

Parameters:
type - the clazz
Method Detail

delete

public void delete(T o)
Specified by:
delete in interface GenericService<T extends DomainObject>

detachFromSession

public void detachFromSession(T o)
Specified by:
detachFromSession in interface GenericService<T extends DomainObject>

findAll

public List<T> findAll()
Specified by:
findAll in interface GenericService<T extends DomainObject>

findByExample

public List<T> findByExample(T exampleInstance)
Specified by:
findByExample in interface GenericService<T extends DomainObject>

findByExample

public List<T> findByExample(T exampleInstance,
                             String[] excludes)
Specified by:
findByExample in interface GenericService<T extends DomainObject>

findByCriteria

protected List<T> findByCriteria(org.hibernate.criterion.Criterion... criterion)
Convenience method for subclasses to find domain objects that match the Criterion's

Parameters:
criterion - array of Criterion's
Returns:
List of domain objects

findByCriteriaOrdered

protected List<T> findByCriteriaOrdered(List<org.hibernate.criterion.Criterion> criterionList,
                                        List<org.hibernate.criterion.Order> orderList)
Convenicence method for subclasses to find domain objects that match the list of Criterion's in the given order

Parameters:
criterionList - List of Criterion's
orderList - List of Order's
Returns:
Sorted list of domain objects

findById

public T findById(Long id)
Description copied from interface: GenericService
Find by primary key

Specified by:
findById in interface GenericService<T extends DomainObject>
Parameters:
id - the entity primary key
Returns:
the domainObject

getCount

public int getCount()
Specified by:
getCount in interface GenericService<T extends DomainObject>

getPersistentClass

public Class<T> getPersistentClass()
Specified by:
getPersistentClass in interface GenericService<T extends DomainObject>

saveOrUpdate

public Long saveOrUpdate(T t)
Specified by:
saveOrUpdate in interface GenericService<T extends DomainObject>

saveOrUpdate

public void saveOrUpdate(Collection<T> coll)
Specified by:
saveOrUpdate in interface GenericService<T extends DomainObject>

getSession

protected org.hibernate.classic.Session getSession()
Returns:
the portalSessionFactory

createCriteria

public org.hibernate.Criteria createCriteria()
Specified by:
createCriteria in interface GenericService<T extends DomainObject>


Copyright © 2009–2013 SURFnet bv, The Netherlands. All rights reserved.