-->
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.  [ 2 posts ] 
Author Message
 Post subject: Simply HQL query, could not resolve property
PostPosted: Tue May 18, 2010 8:37 am 
Newbie

Joined: Wed Mar 11, 2009 7:15 am
Posts: 13
I have a problem with HQL query.
Code:
org.hibernate.QueryException: could not resolve property: classb of: ClassA

This is very simplified model.
Code:
class ClassA{
   @Id
   private long id;
   @ManyToOne(cascade = CascadeType.ALL)
   private ClassB classb;
   
   getters();
   setters();
}

class ClassB{
   @Id
   private long id;
   private String name;
   
   getters();
   setters();
}

I what to have ClassA object list which classb objects have id = 5.
I tried to:
Code:
from ClassA a where a.classb.id = 5;

or
Code:
ClassB classb = ....loadById(5);
from ClassA a where a.classb = classb;

or
Code:
from ClassA a, ClassB b, where a.id = b.id AND b.id=5;

but I want to have a list of ClassA objects, and I dont know what this query returns.

I also tried to DetachedCriteria (I'm using HibernateTemplate) but nothing helps.


Top
 Profile  
 
 Post subject: Re: Simply HQL query, could not resolve property
PostPosted: Wed May 19, 2010 6:50 am 
Newbie

Joined: Wed Mar 11, 2009 7:15 am
Posts: 13
The problem was with wrong name of getter and setter ClassB.
Problem solved.


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

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.