I have called an inheritance hierarchy in Hibernate, the objects we AbstractBase times and Sub1, Sub2. The Strategy is TABLE_PER_CLASS with unions (Business-default, the DB is already there). A class is now assigned to some of the objects of this hierarchy, and it Sub1 and / or Sub2 may be displayed:
Code:
public List <AbstractBase> GetSubObjects () // Fetch Mode: Lazy
Will I get all sub-objects. But I can not check with instanceof, whether it is in each case to Sub1 or Sub2 (because the returned object is a proxy of AbstractBase). After I had the annotation = @ Proxy (lazy false) set for the AbstractBase class, but it works also without problems. Now to my question: I have seen that by this annotation is always a separate query is issued.
SQL: FROM LEFT JOIN FETCH xy.subObjects xy "---> Sets from N + 1 queries.
Actually JONI FETCH should already get all the data in the first query, but apparently is still working with Proxis internally somewhere, and the lazy = false annotation then provides for loading the data. Does anyone have an idea?
Bookmarks