-->
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.  [ 4 posts ] 
Author Message
 Post subject: can getter of an entity be used in hql for filter
PostPosted: Thu Mar 19, 2009 7:44 am 
Newbie

Joined: Thu Mar 19, 2009 7:33 am
Posts: 3
Location: Chennai
Hi,

Can a getter method of an entity be used in hql for filter in where condition ?

like following one

Code:
class Something{
private Long id;

public Long getId(){
return id;
}

public void setId(Long id){
this.id=id;
}

[b]public String getValue(){
return "test";
}[/b]
}

for the above entity can i use following hql ?

from Something s where s.value="test"

plz hlp

_________________
Prabu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 19, 2009 9:53 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Seems ok, assuming that you have mapped the getValue() method to a database column.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 19, 2009 10:24 am 
Newbie

Joined: Thu Mar 19, 2009 7:33 am
Posts: 3
Location: Chennai
i dont have a DB column mapped...

and this is not working.


we say Hibernate is OO then i would realy except it to work all i have is a valid getter. I think Hibernate can include this for there enhancement.

_________________
Prabu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 19, 2009 10:46 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Hibernate is an Object-Relational Mapping (ORM) tool. HQL queries are converted to SQL and processed by a relational database. The result is parsed and put together by Hibernate to build an Object representation of the data.

There is also some kind of mode that maps to XML documents, but I have zero experience with that.


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