-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: QueryException: could not resolve property
PostPosted: Fri May 22, 2009 4:15 pm 
Newbie

Joined: Fri May 22, 2009 4:07 pm
Posts: 2
When I run this method, I get the following error:
Quote:
"org.hibernate.QueryException: could not resolve property: status.statusCode of: com.company.CmpsOrder"
.

Here is the query code:

Code:
Criteria query = session.createCriteria(CmpsOrder.class);
        if ( divisionID != null  && !divisionID.isEmpty()) {
            query.add(Restrictions.eq("division.divisionId", divisionID));
        }
        query.add(Restrictions.eq("status.statusCode", stat));
        query.addOrder(Order.desc("modificationDate"));

        List<CmpsOrder> orderList = query.list();


Here is the relevant CpmsOrder code (with proper getters and setters):

Code:
@Entity
@Table(name="CMS_ORDER")
public class CmpsOrder
{
    private ClientPlatform division;
    private CmpsOrderStatus status;
    private Date modificationDate = new Date();

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="DIVISION_ID")
    public ClientPlatform getDivision() {
        return this.division;
    }

    public void setDivision(ClientPlatform x) {
        this.division = x;
    }
   
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="STATUS_ID")
    public CmpsOrderStatus getStatus() {
        return this.status;
    }

    public void setStatus(CmpsOrderStatus x) {
        this.status = x;
    }

    @Column(name="MODIFICATION_DATE")
    public Date getModificationDate() {
        return this.modificationDate;
    }

    public void setModificationDate(Date x) {
        this.modificationDate = x;
    }
}


And here is the CmpsOrderStatus code:

Code:
@Entity
@Table(name="CMS_ORDER_STATUS")
public class CmpsOrderStatus {

    private long statusID;
    private String statusCode;
    private String description;

    @Id
    @Column(name="STATUS_ID")
    public long getStatusID() {
        return statusID;
    }
    public void setStatusID(long id) {
        this.statusID = id;
    }

    @Column(name="STATUS_CODE")
    public String getStatusCode() {
        return statusCode;
    }
    public void setStatusCode(String code) {
        this.statusCode = code;
    }

    @Column(name="DESCRIPTION")
    public String getDescription() {
        return description;
    }
    public void setDescription(String desc) {
        this.description = desc;
    }
}


What am I missing or doing wrong?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.