I'm getting a NullPointerException with this Java DAO:
public abstract class AbstractDAO<BEAN extends Serializable,
ID extends Serializable>
extends HibernateDaoSupport
implements IDAO<BEAN, ID> {
private Class<BEAN> beanClass;
public AbstractDAO() {
}
public AbstractDAO(Class<BEAN> clazz) {
beanClass = clazz;
}
/**
* {@inheritDoc}
*/
@Transactional
public BEAN findById(ID id) {
@SuppressWarnings("unchecked")
BEAN instance =
(BEAN) getSessionFactory().getCurrentSession().get(beanClass, id);
return instance;
}
}
public class TestCaseDAO extends AbstractDAO<TestCase, Long> {
public TestCaseDAO(Class<TestCase> clazz) {
super(clazz);
}
public TestCaseDAO() {
}
@Override
public void persist(TestCase transientInstance) {
}
}
Exception I get:
Exception in thread "main" java.lang.NullPointerException
Can anyone please help me out?