-->
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: Returning a Collection with a Subset of an associated collec
PostPosted: Sun Dec 21, 2008 4:34 am 
Newbie

Joined: Sun Dec 21, 2008 4:23 am
Posts: 1
Hibernate version: 3.3.1 - i.e no dereferencing ....

Name and version of the database you are using: MySQL 5.0.45



Hi,

I'm after assistance with generating a query. I have a Parent Object "Shape" with a specific name and which has within it a set of "Circles" each with a description.

I'd like to do a search with one input box, where if a user enters a keyword that exists in either the shape name or the circles description, that shape should be returned. This bit i can do easily using an inner join.

However, the result i get is that it retuns the subset of Shapes but ALL of the Circles with in. I would like the query to perform as follows :

- If the keyword exists in the Shape description, it should return that shape with a full subset of circles.
- However, if the keyword exists in the Circle description, i need it to return the associated parent shape and only the circle that includes the keyword.

Hope that makes sense, i've been mucking around with this for hours and done lots of search, but no avail...

If it helps, the collection is a one to many associated with the following annotation...

@OneToMany(mappedBy="shareID",
cascade= CascadeType.REMOVE,
fetch= FetchType.EAGER)
public Set<Circle> getCircles() {}

Thanks heaps !


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.