-->
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: QBE and Association Types
PostPosted: Fri Sep 15, 2006 12:15 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
So it seems Query By Example doesn't support Association types. That's a shame because it would be very nice.

What is the next best way of doing a search?


Here is my situation. I have two objects with a one-to-many relationship: Vendor and VendorSite. Each vendor can have many sites. I want to find the VendorSite's for a particular Vendor.

I would like to avoid using HQL because this piece of my application is generic and used for searching for various objects.


My first thought is to create a search object that joins the two tables together. Something like VendorWithSite and use this object to perform my QBE and then convert the result to a VendorSite object.

I'd like to hear some other ideas on how others do this kind of search.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 2:21 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
I decided to use HQL. But I wish I could query by example. Using QBE allows me to use an object and databinding to provide the user with a search box.

In order to use HQL and the same search box, I would have to parse out the values the user entered and try to formulate HQL. That sounds like a lot of work.


Top
 Profile  
 
 Post subject: See if this topic helps
PostPosted: Mon Jan 08, 2007 11:38 pm 
Newbie

Joined: Mon Oct 18, 2004 1:42 pm
Posts: 10
Location: Ottawa, Canada
See if this topic helps.

http://forum.hibernate.org/viewtopic.php?t=942872

Thanks.

Josh.


Top
 Profile  
 
 Post subject: Re: See if this topic helps
PostPosted: Thu Feb 15, 2007 4:33 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
kafeero wrote:
See if this topic helps.

http://forum.hibernate.org/viewtopic.php?t=942872

Thanks.

Josh.


I'm glad to see that people are trying to get this functionality into Hibernate... maybe someday it will be in NHibernate, too.

I'm not so sure I want to ry to implement it, myself. I have a workaround that I am using that seems to work.

I create search objects for my business objects that have associations. These search objects are attached to views in the database. The properties of these search objects are all "normal" types, like string, int, date, etc. This is basically a flat view of the original business object. So, QBE works fine for these search objects since they do not have any associations.

It is more work, but I feel that it is "safer" than trying to extend the QBE functionality in NHibernate.

Thanks for the link tho!! If I ever get adventerous, I might give it a try. But my deadlines don't allow for much room to play.


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.