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 !
|