It's worth noting that if you have a DocumentBook class that has both a
Document attribute and a DocumentInfo attribute, you will need to take
several steps to avoid conflicts between these objects:
1. Make both relationships outer-join="false" (remember, both items
can't be loaded at the same time)
2. Make both referenced classes have a proxy, so they will be lazily
loaded. proxy="Document" and proxy="DocumentInfo" will suffice. (same
reason as #1)
3. Make the table for Document different from the table for DocumentInfo
using case sensitivity (eg: DOCUMENTS and documents). Otherwise, when
you load one (using a join fetch), Hibernate may attempt to load the
eagerly fetched entity into both the detail and summary fields. If a
summary object is loaded into a detail field, class matching issues will
result. |