-->
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.  [ 3 posts ] 
Author Message
 Post subject: QueryException every time!?
PostPosted: Sun Oct 26, 2003 1:00 pm 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
I'm trying to make a query, as shown below:

( ... )
Iterator it = session.find(
"select b.mp_fk, b.qtd_actual " +
"from a in class test.X, " +
"b in class test.Y, " +
"c in class test.Z " +
"where c.mp_lote_fk = a.id and a.mp_fk = b.mp_fk"
);
( ... )

It keeps giving me :

net.sf.hibernate.QueryException: could not resolve property type: mp_lote_fk ...


Am I doing something wrong? Is there another way of doing these type of queries?
How do I acess the information on every "it.next()"?

Please help.


PS: thanks Emmanuel for the tip on lazy.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 26, 2003 1:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are using property names that looks very much like physical column names. Do you really have a propery called mp_lote_fk - remember to use property names, not column names.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 26, 2003 1:27 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
do you mean
Code:
Iterator it = session.iterator(

or
Code:
List list = session.find(


From the javadoc of iterate
Quote:
Entities returned as results are initialized on demand. The first SQL query returns
* identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve
* objects than <tt>find()</tt>.


Read section 7.3 of the reference guide.

Can't help you much on your query 'cause I don't have your mapping files, but the error tells me mp_lote_fk is not a mapped property of test.Z. Usually in HQL, you do not need to manipulate fks, it's an object query language, so you manipulate objects and relations between objects

An example of 7.3
Code:
select customer, product from Customer customer, Product product join customer.purchases purchase where product = purchase.product

has nothing to do with fk.

Prefer using from test.X as a or from test.X a than a in class test.X, it's the old way to write HQL.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.