-->
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: Recursion and attributes test help
PostPosted: Tue Oct 31, 2006 8:35 pm 
Newbie

Joined: Tue Oct 31, 2006 8:19 pm
Posts: 2
Hi all,

I'm write a query that uses a recursive table structure. Users are doing a search for a particular item in the database and they do not know beforehand where it sits on a tree of items. They search by the attributes of the item and then I will return a list of trees (of items) that contain an item that matches the the attributes.

So the Java objects look like:

Item
-----
Attribute1
Attribute2
Collection<Item>

The tables look like

Item
-----
itemid
attribute1
attribute2

Item_item
------------
itemidmaster
itemidrelated

I've been thinking about how I can approach this problem using hibernate. I don't know of a way to do this kind of query using the HQL, (If you can think of a way, please let me know!) so I'm writing a custom function to return a table of ids that represent the 'roots' of all trees that contain a match, then using Hibernate to construct the object graph.

Is there a way I can do something like

SELECT * FROM table(schema.searchfunction(attribute list)) as search
INNER JOIN item i1 ON i1.itemid= search.itemid

and have Hibernate construct the resulting objects for me?


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.