com.khubla.pragmatach.plugin.hibernate
Class HibernateDAO<T,I extends Serializable>

java.lang.Object
  extended by com.khubla.pragmatach.framework.dao.AbstractDAO<T,I>
      extended by com.khubla.pragmatach.plugin.hibernate.HibernateDAO<T,I>
All Implemented Interfaces:
DAO<T,I>

public class HibernateDAO<T,I extends Serializable>
extends AbstractDAO<T,I>

Author:
tome

Constructor Summary
HibernateDAO(Class<T> typeClazz, Class<I> identifierClazz)
           
 
Method Summary
 long count()
          get the count of rows in table
 void delete(T t)
          delete
 void deletebyId(I i)
          delete
 org.hibernate.Criteria find()
          find by fluent query.
 T findById(I i)
          find by id
 List<T> getAll()
          findall
 List<T> getAll(int start, int count)
          get all
protected static Set<Class<?>> getEntityClasses()
          the annotation scanner will have run; we can just query for annotated classes
 Class<I> getIdentifierClazz()
           
static org.hibernate.SessionFactory getSessionFactory()
           
 Class<T> getTypeClazz()
           
 void reloadConfig()
          do a config reload
 void save(T t)
          save object
 void update(T t)
          update object
 
Methods inherited from class com.khubla.pragmatach.framework.dao.AbstractDAO
getPager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateDAO

public HibernateDAO(Class<T> typeClazz,
                    Class<I> identifierClazz)
Method Detail

getSessionFactory

public static org.hibernate.SessionFactory getSessionFactory()

getEntityClasses

protected static Set<Class<?>> getEntityClasses()
                                         throws PragmatachException
the annotation scanner will have run; we can just query for annotated classes

Throws:
PragmatachException

count

public long count()
           throws PragmatachException
Description copied from interface: DAO
get the count of rows in table

Throws:
PragmatachException

delete

public void delete(T t)
            throws PragmatachException
delete

Throws:
PragmatachException

deletebyId

public void deletebyId(I i)
                throws PragmatachException
delete

Throws:
PragmatachException

find

public org.hibernate.Criteria find()
                            throws PragmatachException
find by fluent query. note that this leaves a session open!

Throws:
PragmatachException

findById

public T findById(I i)
           throws PragmatachException
find by id

Throws:
PragmatachException

getAll

public List<T> getAll()
               throws PragmatachException
findall

Throws:
PragmatachException

getAll

public List<T> getAll(int start,
                      int count)
               throws PragmatachException
Description copied from interface: DAO
get all

Throws:
PragmatachException

getIdentifierClazz

public Class<I> getIdentifierClazz()

getTypeClazz

public Class<T> getTypeClazz()

reloadConfig

public void reloadConfig()
Description copied from interface: DAO
do a config reload


save

public void save(T t)
          throws PragmatachException
save object

Throws:
PragmatachException

update

public void update(T t)
            throws PragmatachException
update object

Throws:
PragmatachException


Copyright © 2014 khubla.com. All rights reserved.