|[Teneo] Is there a way to stop initialize a collection when I only want to add or remove an element? [message #606655]
||Thu, 10 May 2007 10:54
| Anthony Lee
Registered: July 2009
When I want to add an element to a lazy collection, the collection is
According to below Q&A,I set my collection's inverse attribute as "true",
But the collection still be initialized.
Has this issue something to do with Teneo's persistableEList?
How can I prevent this loading?
Q:Why does Hibernate always initialize a collection when I only want to add
or remove an element?
A:Unfortunately the collections API defines method return values that may
only be computed by hitting the database. There are three exceptions to
this: Hibernate can add to a <bag>, <idbag> or <list> declared with
inverse="true" without initializing the collection; the return value must
always be true.
If you want to avoid extra database traffic (ie. in performance critical
code), refactor your model to use only many-to-one associations. This is
almost always possible. Then use queries in place of collection access.
Powered by FUDForum
. Page generated in 0.01882 seconds