-->
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.  [ 1 post ] 
Author Message
 Post subject: Criteria with a complex object
PostPosted: Fri Mar 23, 2012 4:22 pm 
Newbie

Joined: Mon Feb 20, 2012 1:53 pm
Posts: 2
I've been kicking around the Internet for a few days looking for a good way to handle a problem I'm having. I'm in the process of converting an older webapp from using a homegrown ORM to Hibernate. Things have been running fairly smoothly until I came across one fairly complex object graph. This graph is represented by about 2 dozen different objects, up to 8 layers deep in some places, and full of copious "to-many" relationships.

Mapping the graph for retrieval went fine; the problem is searching on the thing. If it matters, I have a Struts 2 action that takes a bunch of user input. My evil plan is to construct a Criteria from this and get the matching objects back. The portion I'm really having trouble with is that many of the values are represented as ranges (either between or greater/less than) between two different values stored on this object graph. Since the users may or may not choose to search on any of about 100 fields, it seems really tedious to just put their values on a simple map then check whether they and any necessary associated values exist in some sort of Hibernate backed DAO and create individual Criterion objects for each of these. Additionally, I have about 10 other objects of similar complexity that will eventually be rewritten.

So, this is my question: has anyone written a dynamic search on a large complex graph or does anyone have an idea as to how it might be done other than by specifying line-by-line the appropriate restrictions? I have had a few ideas, but they've been shot down by some others in my group for being excessively complex. As I stated, I have yet to find a "good" agreed upon way to do this, but it seems that it shouldn't be terribly uncommon.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.