-->
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: HQL queries with property names
PostPosted: Sun Dec 28, 2003 4:41 am 
Newbie

Joined: Sun Dec 28, 2003 4:37 am
Posts: 2
Excuse me for dumb lamer question.
Why in HQL queries i have to provide real column names instead of property names ?
For example column name is logname while corresponding property is LoginName. Is it possible to use LoginName in queries, not logname ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 28, 2003 7:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I dont really get what you mean. Of course you use propertys in a HQL query, if you have a mapped class like this:

Code:
public class Foo {
        public String getBar() {...}
}

You can of course do a HQL query like

Code:
FROM Foo f WHERE f.bar = "whatever"

even if your bar property is mapped to any_table_column


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 28, 2003 2:05 pm 
Newbie

Joined: Sun Dec 28, 2003 4:37 am
Posts: 2
Thank you. It works. My problem was that i did not use object alias. i.e. LoginName = :login instead of w.LoginName = :login

It looks like if you do not provide alias with property names, hibernate works directly with table columns.


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.