Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Annotation required to stop cascade updates
[Teneo] Annotation required to stop cascade updates [message #427667] Wed, 25 February 2009 15:26 Go to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

I am using the following annotation for a one to many related entity.

<xsd:element ecore:opposite="instrumentDomain" minOccurs="0"
maxOccurs="unbounded" name="futurePrice" type="gensec:FuturePrice" >
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">@OneToMany(fetch=LAZY
cascade={REMOVE} indexed=false)</xsd:appinfo>
</xsd:annotation>
</xsd:element>

Since I do not include PERSIST MERGE or REFRESH I expected the only
action to occurs is have the related entities removed when I delete the
parent.

What I actually get is when I insert a new FuturePrice for a given
instrumentDomain it generates a UPDATE statement for every one of the
existing FuturePrice objects in the database, which can be over one
thousand. I want these FuturePrice to remain untouched by any operation
on InstrumentDomain or insertion or update to any other FuturePrice
entity that happens to be related to the InstrumentDomain object concerned.

I found no example of the Hibernate specific HbCascaseType of
DELETE_ORPHAN. How is that expressed? Maybe that is what I need?

Thx.

David
Re: [Teneo] Annotation required to stop cascade updates [message #427670 is a reply to message #427667] Wed, 25 February 2009 15:51 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
Is anything specific updated in the other futureprices (when you insert a new one)? I see that you have indexed on
false, so it is not the index field which is changed.

Teneo also supports most of the hibernate specific annotation set:
http://www.hibernate.org/hib_docs/annotations/reference/en/h tml_single/

One of them is the Cascade, so I think you should have something like this:
@Cascade( { DELETE_ORPHAN, REMOVE } )
you can keep the cascade in the OneToMany, the @Cascade annotation takes precedence.

gr. Martin

David Wynter wrote:
> Hi,
>
> I am using the following annotation for a one to many related entity.
>
> <xsd:element ecore:opposite="instrumentDomain" minOccurs="0"
> maxOccurs="unbounded" name="futurePrice" type="gensec:FuturePrice" >
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">@OneToMany(fetch=LAZY
> cascade={REMOVE} indexed=false)</xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
>
> Since I do not include PERSIST MERGE or REFRESH I expected the only
> action to occurs is have the related entities removed when I delete the
> parent.
>
> What I actually get is when I insert a new FuturePrice for a given
> instrumentDomain it generates a UPDATE statement for every one of the
> existing FuturePrice objects in the database, which can be over one
> thousand. I want these FuturePrice to remain untouched by any operation
> on InstrumentDomain or insertion or update to any other FuturePrice
> entity that happens to be related to the InstrumentDomain object concerned.
>
> I found no example of the Hibernate specific HbCascaseType of
> DELETE_ORPHAN. How is that expressed? Maybe that is what I need?
>
> Thx.
>
> David


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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
Previous Topic:xsd exported, but
Next Topic:How to annotate attribute of type xsd:long to be of type LongObject in Ecore model
Goto Forum:
  


Current Time: Fri Sep 20 12:07:38 GMT 2024

Powered by FUDForum. Page generated in 0.03024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top