hibernate中发出查询语句但还是java.lang.NullPointerException
selectfunction0_.function_Idasfunction1_17_,function0_.functionNameasfunction2_17_,fu...
select
function0_.function_Id as function1_17_,
function0_.functionName as function2_17_,
function0_.functionUrl as function3_17_,
function0_.status as status17_,
function0_.isLeaf as isLeaf17_,
function0_.orderNum as orderNum17_,
function0_.parent as parent17_,
function0_.registTime as registTime17_,
function0_.changeTime as changeTime17_,
function0_.register as register17_,
function0_.changer as changer17_
from
T_Function function0_
where
function0_.status=0
order by
function0_.orderNum
java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:830)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:930)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
测试通过!!??
try{
ApplicationContext ac=new ClassPathXmlApplicationContext("resources/*/*.xml");
CRMSystemDao a=(CRMSystemDao)ac.getBean("cRMsystemDao");
List<SFunction> list=a.getByHqlFunctionWEb("from SFunction f where f.status = 0 order by f.orderNum");
System.out.println(list.size());
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
} 展开
function0_.function_Id as function1_17_,
function0_.functionName as function2_17_,
function0_.functionUrl as function3_17_,
function0_.status as status17_,
function0_.isLeaf as isLeaf17_,
function0_.orderNum as orderNum17_,
function0_.parent as parent17_,
function0_.registTime as registTime17_,
function0_.changeTime as changeTime17_,
function0_.register as register17_,
function0_.changer as changer17_
from
T_Function function0_
where
function0_.status=0
order by
function0_.orderNum
java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:830)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:930)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
测试通过!!??
try{
ApplicationContext ac=new ClassPathXmlApplicationContext("resources/*/*.xml");
CRMSystemDao a=(CRMSystemDao)ac.getBean("cRMsystemDao");
List<SFunction> list=a.getByHqlFunctionWEb("from SFunction f where f.status = 0 order by f.orderNum");
System.out.println(list.size());
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
} 展开
4个回答
展开全部
去掉order by 再试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
AbstractEntityTuplizer 这个对象是空的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看一下你的实体映射文件是否和数据库的字段合类型对应
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询