-2
我得到一個NullPointerException與此Java DAO:的NullPointerException在SELECT查詢春季休眠
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 in thread "main" java.lang.NullPointerException
任何人都可以請幫我嗎?