Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 524659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:35:28+00:00 2026-05-13T08:35:28+00:00

I have one table with composite key attribute.. For that i have made 2

  • 0

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<WBList> 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<WBList> 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.<init>(CriteriaJoinWalker.java:90)
    org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:59)
    org.hibernate.loader.criteria.CriteriaLoader.<init>(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..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:35:28+00:00Added an answer on May 13, 2026 at 8:35 am

    rid and sid are properties of composite identifier (WbListPK), not the entity itself. You, therefore, need to refer to them accordingly:

    if(wbListPK.getRid()!=0){
      criteria.add(Expression.eq("id.rid", wbListPK.getRid()));
    }
    if(wbListPK.getSid()!=0){
      criteria.add(Expression.eq("id.sid", wbListPK.getSid()));
    }
    

    Note the id. prefix. See where clause and referring to id property chapters in Hibernate documentation for more details / examples (they deal with HQL but majority of stuff applies to Criteria API as well)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 374k
  • Answers 374k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes. Both dinner and ViewData["dinner"] will be available on the… May 14, 2026 at 7:48 pm
  • Editorial Team
    Editorial Team added an answer threadId should be the id of the SMS/MMS thread you… May 14, 2026 at 7:48 pm
  • Editorial Team
    Editorial Team added an answer First, I think your searches are a bit too generic.… May 14, 2026 at 7:48 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.