Getting Hibernate Exception : org.hibernate.QueryException: could not resolve property

I have one table with composite key attribute.. For that i have made 2 beans for hibernate annotations mappings.. Now, it works fine for save, update and delete.. But when I am fetching using some criteria, it's giving me "could not resolve property" exception. My Beans are as follows : WBList.java =========== @Entity public class WBList { private WBListPK id; private String wb; @Id public WBListPK getId() { return id; } public void setId(WBListPK id) { this.id = id; } @Column(name = "wb") public String getWb() { return wb; } public void setWb(String wb) { this.wb = wb; } } WBListPK.java ============= @Embeddable public class WBListPK implements Serializable { private int rid; private int sid; public WBListPK() { } public WBListPK(Integer rid, Integer sid) { this.rid = rid; this.sid = sid; } public int getRid() { return rid; } public void setRid(int rid) { this.rid = rid; } public int getSid() { return sid; } public void setSid(int sid) { this.sid = sid; } } FindByAll Method of My DAO is as follows : public List findByAll(final WBListPK wbListPK, final String wb) { List results = null; results = this.hibernateTemplate.executeFind(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Criteria criteria = session.createCriteria(WBList.class); if (wb != null) { criteria.add(Expression.like("wb", wb)); } if(wbListPK.getRid()!=0){ criteria.add(Expression.eq("rid", wbListPK.getRid())); } if(wbListPK.getSid()!=0){ criteria.add(Expression.eq("sid", wbListPK.getSid())); } return criteria.list(); } }); return results; } I am calling this findByAll method from my controller, the code is : WBListPK wbListPK = new WBListPK(); WBList wbList = new WBList(); wbListPK.setRid(10); wbListPK.setSid(20); List wbListList = this.wbListSecurityProcessor.findByAll(wbListPK, "b"); System.out.println("wbListList = "+wbListList); When I am executing above code, it's giving me following exception (with stacktrace): org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: rid of: com.sufalam.mailserver.bean.WBList; nested exception is org.hibernate.QueryException: could not resolve property: rid of: com.sufalam.mailserver.bean.WBList org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:655) org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343) com.sufalam.mailserver.dao.WBListDao.findByAll(WBListDao.java:42) com.sufalam.mailserver.business.WBListProcessor.findByAll(WBListProcessor.java:33) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) $Proxy113.findByAll(Unknown Source) com.sufalam.mailserver.business.security.WBListSecurityProcessor.findByAll(WBListSecurityProcessor.java:28) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) $Proxy120.findByAll(Unknown Source) com.sufalam.mailserver.presentation.web.WBListManageController.handleRequest(WBListManageController.java:65) org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:781) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:726) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:636) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:545) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) root cause org.hibernate.QueryException: could not resolve property: rid of: com.sufalam.mailserver.bean.WBList org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44) org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38) org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1379) org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:31) org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1354) org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:434) org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumnsUsingProjection(CriteriaQueryTranslator.java:394) org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:45) org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:334) org.hibernate.loader.criteria.CriteriaJoinWalker.(CriteriaJoinWalker.java:90) org.hibernate.loader.criteria.CriteriaJoinWalker.(CriteriaJoinWalker.java:59) org.hibernate.loader.criteria.CriteriaLoader.(CriteriaLoader.java:69) org.hibernate.impl.SessionImpl.list(SessionImpl.java:1554) org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) com.sufalam.mailserver.dao.WBListDao$1.doInHibernate(WBListDao.java:59) org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343) com.sufalam.mailserver.dao.WBListDao.findByAll(WBListDao.java:42) com.sufalam.mailserver.business.WBListProcessor.findByAll(WBListProcessor.java:33) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) $Proxy113.findByAll(Unknown Source) com.sufalam.mailserver.business.security.WBListSecurityProcessor.findByAll(WBListSecurityProcessor.java:28) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) $Proxy120.findByAll(Unknown Source) com.sufalam.mailserver.presentation.web.WBListManageController.handleRequest(WBListManageController.java:65) org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:781) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:726) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:636) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:545) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) Please help me if anybody have any solutions.. Thanks in advance..

以上就是Getting Hibernate Exception : org.hibernate.QueryException: could not resolve property的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏