跪求高手解决ssh问题
远航的帆 2012-06-11 08:13:41 数据库有数据,但就是查询不到,用的sqlserver2005,
代码如下:
public T queryEntity(T t,Serializable id) throws Exception{
try{
return (T) this.getHibernateTemplate().load(Class.forName(t.getClass().getName()), id);
}catch(RuntimeException e){
logger.error("查询实体异常"+t.getClass().getName(),e);
throw e;
}
}
测试类:
public class Test {
public static void main(String[] args) {
Function function =new Function();
AuthorityDaoImpl authorityDaoImpl=new AuthorityDaoImpl();
try {
authorityDaoImpl.queryAllEntity(function);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
报如下错误:
log4j:WARN No appenders could be found for logger (com.hr.platform.dao.BaseHibernateDao).
log4j:WARN Please initialize the log4j system properly.
java.lang.NullPointerException
at com.hr.platform.dao.BaseHibernateDao.queryAllEntity(BaseHibernateDao.java:63)
at com.hr.authority.test.Test.main(Test.java:11)