-->
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: HQL Query without exposing datamodel/bean attributes.
PostPosted: Thu Feb 01, 2007 5:19 am 
Newbie

Joined: Thu Jan 25, 2007 4:57 am
Posts: 5
Hi,

Is it possible to write a HQL Query without exposing datamodel/bean attributes with "where" clause ?

When we write a Hql query with where clause, it looks somthing like:

"From Foo where Foo.name='%F' "

However, the knowledge that Foo has an attribute "name" should be available to the user.

What if User is only aware of getters and setters in datamodel "Foo", Is it can still possible to construct a Hql query?

_________________
RgDs
~Nitu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 8:21 am 
Newbie

Joined: Thu Jan 25, 2007 4:57 am
Posts: 5
Hi All,

I solved this problem by having string constants withi values of the property names. It works for me this way.

Thanks Anyways.

_________________
RgDs
~Nitu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 9:32 am 
Regular
Regular

Joined: Mon Aug 07, 2006 6:22 pm
Posts: 67
Hibernate allows you to map to JavaBean getters/setters (default), or directly to fields, depending on what you specify in the mapping. If you want to hide the actual field names, and map to the JavaBean properties specified by the getters/setters, then that's fine.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 12:14 am 
Newbie

Joined: Thu Jan 25, 2007 4:57 am
Posts: 5
thanks for the reply.

My problem was to access column names from client code to write Hql queries. The getter and setter methods would not be much of help here.

_________________
RgDs
~Nitu


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.