Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] Annotation of EReference with no cascades
[Texo] Annotation of EReference with no cascades [message #1699432] Wed, 24 June 2015 09:52 Go to next message
Mr Cur is currently offline Mr CurFriend
Messages: 31
Registered: September 2014
Member
Hi,

I want to annotate an EReference such that no cascades are generated.
I have a class with a reference to itself. When an instance refers to itself (via some other instance), this results in an exception when merge() on the same instance is applied twice.

This happens because the generated JPA code for the class has the cascade.merge (amongst others) annotation for the EReference.

So, I want to remove this JPA annotation, preferably by an texo annotation model.
Here is what I did:
in the annotation model:
- added annotation for the EReference
- added an ORM annotation
- added a many-to-many annotation
- added cascade type annotation
- added empty type cascade annotation
However the annotation editor returns then with following error:
An error has occurred. See error log for more details.
The string resource '_UI_cascadeDetach' could not be located

The resulting annotation looks as follows:
<eReferenceAnnotations xsi:type="ormannotations:EReferenceORMAnnotation">
<manyToMany>
<cascade>
<cascadeDetach/>
</cascade>
</manyToMany>
</eReferenceAnnotations>

Generation of JPA classes also results in an error.

Help is appreciated.

Cur

Re: [Texo] Annotation of EReference with no cascades [message #1702867 is a reply to message #1699432] Sun, 26 July 2015 23:07 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Cur,
Hmm I missed your post. In any case I published a new build just now which should solve this problem. Let me know if it
stills occurs.

gr. Martin

On 24-06-15 11:52, Mr Cur wrote:
> Hi,
>
> I want to annotate an EReference such that no cascades are generated.
> I have a class with a reference to itself. When an instance refers to itself (via some other instance), this results in
> an exception when merge() on the same instance is applied twice.
>
> This happens because the generated JPA code for the class has the cascade.merge (amongst others) annotation for the
> EReference.
>
> So, I want to remove this JPA annotation, preferably by an texo annotation model.
> Here is what I did:
> in the annotation model:
> - added annotation for the EReference
> - added an ORM annotation
> - added a many-to-many annotation
> - added cascade type annotation
> - added empty type cascade annotation
> However the annotation editor returns then with following error:
> An error has occurred. See error log for more details.
> The string resource '_UI_cascadeDetach' could not be located
>
> The resulting annotation looks as follows:
> <eReferenceAnnotations xsi:type="ormannotations:EReferenceORMAnnotation">
> <manyToMany>
> <cascade>
> <cascadeDetach/>
> </cascade>
> </manyToMany>
> </eReferenceAnnotations>
>
> Generation of JPA classes also results in an error.
>
> Help is appreciated.
>
> Cur
>
>


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Annotation of EReference with no cascades [message #1703139 is a reply to message #1699432] Tue, 28 July 2015 20:10 Go to previous messageGo to next message
Mr Cur is currently offline Mr CurFriend
Messages: 31
Registered: September 2014
Member
Hi Martin,

Thanks for the update.

I experience still a problem with the code generation.

With the following annotation for a bi-directional JPA relation:

<manyToMany mappedBy="myrelation">
<cascade>
<cascadeDetach/>
</cascade>
</manyToMany>

the following code is generated:

@javax.persistence.ManyToMany(, mappedBy="myrelation")

which does not compile (due to the ',');

Btw: the inverse relation (with no mappedBy annotion) generates:

@javax.persistence.ManyToMany()

which seems to be ok.

Thanks.

-- Cur
Re: [Texo] Annotation of EReference with no cascades [message #1703607 is a reply to message #1703139] Mon, 03 August 2015 15:07 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Cur,
A mistake, I published a new build which solves this. The detach cascade type was not handled correctly. I solved this
also. If you don't want cascade you should create a cascadetype node without cascades inside it.

gr. Martin

On 28-07-15 22:10, Mr Cur wrote:
> Hi Martin,
>
> Thanks for the update.
>
> I experience still a problem with the code generation.
>
> With the following annotation for a bi-directional JPA relation:
>
> <manyToMany mappedBy="myrelation">
> <cascade>
> <cascadeDetach/>
> </cascade>
> </manyToMany>
>
> the following code is generated:
>
> @javax.persistence.ManyToMany(, mappedBy="myrelation")
>
> which does not compile (due to the ',');
>
> Btw: the inverse relation (with no mappedBy annotion) generates:
>
> @javax.persistence.ManyToMany()
>
> which seems to be ok.
>
> Thanks.
>
> -- Cur


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[EMF] Exception when using remove/removeAll
Next Topic:[Teneo Auditing] TENEO_CONTAINER_FEATURE_ID maintenance after model changing
Goto Forum:
  


Current Time: Mon Feb 17 22:25:43 GMT 2020

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

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

Back to the top