hibernate使用原生sql语句,我贴出源代码,和错误,我知道是空指针异常,但是为什么会出现呢?
publicList<TaxInformVO>QueryTax(){StringSQL="select*fromtt";System.out.println(SQL);S...
public List<TaxInformVO> QueryTax() {
String SQL = "select * from tt";
System.out.println(SQL);
SQLQuery query1 = this.getSession().createSQLQuery(SQL);
List<Object[]> objs = query1.list();
System.out.println(objs);
下面是报的错
select * from tt
Exception in thread "main" java.lang.NullPointerException
at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:140)
at com.hqjy.daoImpl.OperationTaxDaoImpl.QueryTax(OperationTaxDaoImpl.java:216)
at com.hqjy.daoImpl.OperationTaxDaoImpl.main(OperationTaxDaoImpl.java:203) 展开
String SQL = "select * from tt";
System.out.println(SQL);
SQLQuery query1 = this.getSession().createSQLQuery(SQL);
List<Object[]> objs = query1.list();
System.out.println(objs);
下面是报的错
select * from tt
Exception in thread "main" java.lang.NullPointerException
at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:140)
at com.hqjy.daoImpl.OperationTaxDaoImpl.QueryTax(OperationTaxDaoImpl.java:216)
at com.hqjy.daoImpl.OperationTaxDaoImpl.main(OperationTaxDaoImpl.java:203) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |