hi,
I have an object with some other objects related to it with the "one-to-many" relation.
These mappings have fetchType=EAGER and fetchMode=SUBSELECT.
Code:
@OneToMany(mappedBy = "id.object", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@Fetch(value = FetchMode.SUBSELECT)
@Cache(region = "business", usage = CacheConcurrencyStrategy.READ_WRITE)
public Collection<ObjectChild> getObjectChild() {
return objectChild;
}
It's a very large application that uses this object for years, so I can't change those fetch modes.
But, there is one case that I need the LAZY fetching:
I want to select the major object with only two other related collections.
Now, when I use the Criteria or HQL APIs, hibernate generates a lot of queries to select all the objects that are related to my major object.
( I can't use a "Named Query" because I have criteria I should add to the query.)
What can I do in order to select only the objects want to select?
Thanks a lot