|
Re: [Teneo] Is there a way to stop initialize a collection when I only want to add or remove an elem [message #82900 is a reply to message #82885] |
Thu, 10 May 2007 11:07 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Yes, this is is currently how Teneo works. You can enter a bugzilla for this but I am not sure if it
is solvable. Also I am currently very busy so it will be a probably 2 weeks before the next teneo
release.
As the hb faq says another option (if you control the model): then for the large collections you can
also choose to change them to many-to-one's (so only persist the reference from the child to the
parent) and load the one-to-many relation (parent to child) on demand through an explicit query
(make the many-reference from the parent to the child transient).
Adding to the parent is then done by setting the parent feature in the child.
gr. Martin
Anthony wrote:
> Hi,
>
> When I want to add an element to a lazy collection, the collection is
> initilized.
>
> 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.
> ============================================================ ==============
>
>
>
>
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: [Teneo] Is there a way to stop initialize a collection when I only want to add or remove an elem [message #606656 is a reply to message #82885] |
Thu, 10 May 2007 11:07 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Yes, this is is currently how Teneo works. You can enter a bugzilla for this but I am not sure if it
is solvable. Also I am currently very busy so it will be a probably 2 weeks before the next teneo
release.
As the hb faq says another option (if you control the model): then for the large collections you can
also choose to change them to many-to-one's (so only persist the reference from the child to the
parent) and load the one-to-many relation (parent to child) on demand through an explicit query
(make the many-reference from the parent to the child transient).
Adding to the parent is then done by setting the parent feature in the child.
gr. Martin
Anthony wrote:
> Hi,
>
> When I want to add an element to a lazy collection, the collection is
> initilized.
>
> 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.
> ============================================================ ==============
>
>
>
>
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Powered by
FUDForum. Page generated in 0.03413 seconds