Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TENEO] How to avoid mapping of transient EReferences?
[TENEO] How to avoid mapping of transient EReferences? [message #100183] Thu, 25 October 2007 11:50 Go to next message
Eclipse UserFriend
Originally posted by: david.skogan.gmail.com

Hi,

I have an ecore file with EClasses that have transient EReferences to
classes in other ecore files. In my main.ecore file I have many of the
following:

<eStructuralFeatures xsi:type="ecore:EReference" name="e1"
eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">

For some reason teneo insist on annotating/mapping these references. But I
do not want that, I want teneo to ignore them. They are transient, and as I
understand it transient is the oposit of persistent.

Unfortunately, the other ecore models are quite complex so that
teneo/hibernate eats up all my available heap space (1024M). Hence, I cannot
use hibernate.

How can I avoid mapping these unvanted ecore models?

Regards
David
Re: [TENEO] How to avoid mapping of transient EReferences? [message #100214 is a reply to message #100183] Thu, 25 October 2007 19:35 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
The logic to determine if an ereference is transient has some particular details:
Here is the part of the source code which determines this (see the EFeatureAnnotator class):

// a feature is transient if:
// - transient is true and it is an eattribute or
// - transient is true and it does not have an opposite
// - transietn is true and it's opposite is not a containment
// relation
// - it refers to an eclass which is transient
boolean isTransient =
eStructuralFeature.isTransient() &&
(eStructuralFeature instanceof EAttribute ||
((EReference) eStructuralFeature).getEOpposite() == null ||
!((EReference) eStructuralFeature).getEOpposite().isContainment() || ((EReference)
eStructuralFeature).getEOpposite().isTransient());

// check if the refered to eclass is transient if so then this efeature is
// also transient
if (!isTransient && eStructuralFeature instanceof EReference) {
final PAnnotatedEReference aReference = (PAnnotatedEReference) aStructuralFeature;
if (aReference.getAReferenceType() != null) {
isTransient = aReference.getAReferenceType().getTransient() != null;
}
}

Does this apply to your ereferences?
You can always force transient by setting a Transient annotation to the EReference.

gr. Martin

David Skogan wrote:
> Hi,
>
> I have an ecore file with EClasses that have transient EReferences to
> classes in other ecore files. In my main.ecore file I have many of the
> following:
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
> eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">
>
> For some reason teneo insist on annotating/mapping these references. But I
> do not want that, I want teneo to ignore them. They are transient, and as I
> understand it transient is the oposit of persistent.
>
> Unfortunately, the other ecore models are quite complex so that
> teneo/hibernate eats up all my available heap space (1024M). Hence, I cannot
> use hibernate.
>
> How can I avoid mapping these unvanted ecore models?
>
> Regards
> David
>
>


--

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] How to avoid mapping of transient EReferences? [message #100257 is a reply to message #100214] Fri, 26 October 2007 12:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: david.skogan.gmail.com

Hi Martin,

I have debugged the code and my ereferences are found transient because they
do not have any opposite, and there is no composition either. I have also,
to be sure, added the following annotation to my references.

<eAnnotations source="teneo.jpa">

<details key="appinfo" value="@Transient"/>

</eAnnotations>

However, instead of ignoring the ereference the code goes on and insist on
creating a manyToOneReferenceAnnotator mapping for my transient ereferences
and thus require the target EClass to be registered. And it does not seem
natural to annotate all target EClasses as transient either.

In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method you
have commented out



// if (aStructuralFeature.getTransient() != null) return;

Shouldn't this be uncommented and functional code. At least for plain
ereferences.

Regards

David

"Martin Taal" <mtaal@elver.org> wrote in message
news:ffqr67$c6d$1@build.eclipse.org...
> Hi David,
> The logic to determine if an ereference is transient has some particular
> details:
> Here is the part of the source code which determines this (see the
> EFeatureAnnotator class):
>
> // a feature is transient if:
> // - transient is true and it is an eattribute or
> // - transient is true and it does not have an opposite
> // - transietn is true and it's opposite is not a containment
> // relation
> // - it refers to an eclass which is transient
> boolean isTransient =
> eStructuralFeature.isTransient() &&
> (eStructuralFeature instanceof EAttribute ||
> ((EReference) eStructuralFeature).getEOpposite() == null ||
> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>
> // check if the refered to eclass is transient if so then this efeature is
> // also transient
> if (!isTransient && eStructuralFeature instanceof EReference) {
> final PAnnotatedEReference aReference = (PAnnotatedEReference)
> aStructuralFeature;
> if (aReference.getAReferenceType() != null) {
> isTransient = aReference.getAReferenceType().getTransient() != null;
> }
> }
>
> Does this apply to your ereferences?
> You can always force transient by setting a Transient annotation to the
> EReference.
>
> gr. Martin
>
> David Skogan wrote:
>> Hi,
>>
>> I have an ecore file with EClasses that have transient EReferences to
>> classes in other ecore files. In my main.ecore file I have many of the
>> following:
>>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>> eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">
>>
>> For some reason teneo insist on annotating/mapping these references. But
>> I do not want that, I want teneo to ignore them. They are transient, and
>> as I understand it transient is the oposit of persistent.
>>
>> Unfortunately, the other ecore models are quite complex so that
>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>> cannot use hibernate.
>>
>> How can I avoid mapping these unvanted ecore models?
>>
>> Regards
>> David
>
>
> --
>
> 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] How to avoid mapping of transient EReferences? [message #100298 is a reply to message #100257] Mon, 29 October 2007 06:01 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
The line is commented out on purpose (see the remark just above it). The transient should be handled
in the specific mapper (hibernate or jpox). So for these efeatures the system (for hibernate) should
end up in BasicMapper.processTransient (which does not create a mapping for a transient).

When you debug does the system add a transient annotation to the efeature (see arround line 104 in
the EFeatureAnnotator)?

I think I also see what your issue is: even if the ereference is transient, it requires you to
register the target eclasses with the datastore, with as a result that they will be mapped also to
the db (which you don't want), correct?

gr. Martin

David Skogan wrote:
> Hi Martin,
>
> I have debugged the code and my ereferences are found transient because they
> do not have any opposite, and there is no composition either. I have also,
> to be sure, added the following annotation to my references.
>
> <eAnnotations source="teneo.jpa">
>
> <details key="appinfo" value="@Transient"/>
>
> </eAnnotations>
>
> However, instead of ignoring the ereference the code goes on and insist on
> creating a manyToOneReferenceAnnotator mapping for my transient ereferences
> and thus require the target EClass to be registered. And it does not seem
> natural to annotate all target EClasses as transient either.
>
> In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method you
> have commented out
>
>
>
> // if (aStructuralFeature.getTransient() != null) return;
>
> Shouldn't this be uncommented and functional code. At least for plain
> ereferences.
>
> Regards
>
> David
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:ffqr67$c6d$1@build.eclipse.org...
>> Hi David,
>> The logic to determine if an ereference is transient has some particular
>> details:
>> Here is the part of the source code which determines this (see the
>> EFeatureAnnotator class):
>>
>> // a feature is transient if:
>> // - transient is true and it is an eattribute or
>> // - transient is true and it does not have an opposite
>> // - transietn is true and it's opposite is not a containment
>> // relation
>> // - it refers to an eclass which is transient
>> boolean isTransient =
>> eStructuralFeature.isTransient() &&
>> (eStructuralFeature instanceof EAttribute ||
>> ((EReference) eStructuralFeature).getEOpposite() == null ||
>> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
>> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>>
>> // check if the refered to eclass is transient if so then this efeature is
>> // also transient
>> if (!isTransient && eStructuralFeature instanceof EReference) {
>> final PAnnotatedEReference aReference = (PAnnotatedEReference)
>> aStructuralFeature;
>> if (aReference.getAReferenceType() != null) {
>> isTransient = aReference.getAReferenceType().getTransient() != null;
>> }
>> }
>>
>> Does this apply to your ereferences?
>> You can always force transient by setting a Transient annotation to the
>> EReference.
>>
>> gr. Martin
>>
>> David Skogan wrote:
>>> Hi,
>>>
>>> I have an ecore file with EClasses that have transient EReferences to
>>> classes in other ecore files. In my main.ecore file I have many of the
>>> following:
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>>> eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">
>>>
>>> For some reason teneo insist on annotating/mapping these references. But
>>> I do not want that, I want teneo to ignore them. They are transient, and
>>> as I understand it transient is the oposit of persistent.
>>>
>>> Unfortunately, the other ecore models are quite complex so that
>>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>>> cannot use hibernate.
>>>
>>> How can I avoid mapping these unvanted ecore models?
>>>
>>> Regards
>>> David
>>
>> --
>>
>> 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
>
>


--

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] How to avoid mapping of transient EReferences? [message #100313 is a reply to message #100298] Tue, 30 October 2007 08:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: david.skogan.gmail.com

"Martin Taal" <mtaal@elver.org> wrote in message
news:fg3t08$ec9$1@build.eclipse.org...
> Hi David,
> The line is commented out on purpose (see the remark just above it). The
> transient should be handled in the specific mapper (hibernate or jpox). So
> for these efeatures the system (for hibernate) should end up in
> BasicMapper.processTransient (which does not create a mapping for a
> transient).
>
> When you debug does the system add a transient annotation to the efeature
> (see arround line 104 in the EFeatureAnnotator)?

Not after I annotated them with @Transient

>
> I think I also see what your issue is: even if the ereference is
> transient, it requires you to register the target eclasses with the
> datastore, with as a result that they will be mapped also to the db (which
> you don't want), correct?

Exactly, I do not want them in the db at all. Any ideas of how to avoid
this.

David

>
> gr. Martin
>
> David Skogan wrote:
>> Hi Martin,
>>
>> I have debugged the code and my ereferences are found transient because
>> they do not have any opposite, and there is no composition either. I have
>> also, to be sure, added the following annotation to my references.
>>
>> <eAnnotations source="teneo.jpa">
>>
>> <details key="appinfo" value="@Transient"/>
>>
>> </eAnnotations>
>>
>> However, instead of ignoring the ereference the code goes on and insist
>> on creating a manyToOneReferenceAnnotator mapping for my transient
>> ereferences and thus require the target EClass to be registered. And it
>> does not seem natural to annotate all target EClasses as transient
>> either.
>>
>> In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method
>> you have commented out
>>
>>
>>
>> // if (aStructuralFeature.getTransient() != null) return;
>>
>> Shouldn't this be uncommented and functional code. At least for plain
>> ereferences.
>>
>> Regards
>>
>> David
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:ffqr67$c6d$1@build.eclipse.org...
>>> Hi David,
>>> The logic to determine if an ereference is transient has some particular
>>> details:
>>> Here is the part of the source code which determines this (see the
>>> EFeatureAnnotator class):
>>>
>>> // a feature is transient if:
>>> // - transient is true and it is an eattribute or
>>> // - transient is true and it does not have an opposite
>>> // - transietn is true and it's opposite is not a containment
>>> // relation
>>> // - it refers to an eclass which is transient
>>> boolean isTransient =
>>> eStructuralFeature.isTransient() &&
>>> (eStructuralFeature instanceof EAttribute ||
>>> ((EReference) eStructuralFeature).getEOpposite() == null ||
>>> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
>>> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>>>
>>> // check if the refered to eclass is transient if so then this efeature
>>> is
>>> // also transient
>>> if (!isTransient && eStructuralFeature instanceof EReference) {
>>> final PAnnotatedEReference aReference = (PAnnotatedEReference)
>>> aStructuralFeature;
>>> if (aReference.getAReferenceType() != null) {
>>> isTransient = aReference.getAReferenceType().getTransient() != null;
>>> }
>>> }
>>>
>>> Does this apply to your ereferences?
>>> You can always force transient by setting a Transient annotation to the
>>> EReference.
>>>
>>> gr. Martin
>>>
>>> David Skogan wrote:
>>>> Hi,
>>>>
>>>> I have an ecore file with EClasses that have transient EReferences to
>>>> classes in other ecore files. In my main.ecore file I have many of the
>>>> following:
>>>>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>>>> eType="ecore:EClass some.ecore#//Breakdown_realization"
>>>> transient="true">
>>>>
>>>> For some reason teneo insist on annotating/mapping these references.
>>>> But I do not want that, I want teneo to ignore them. They are
>>>> transient, and as I understand it transient is the oposit of
>>>> persistent.
>>>>
>>>> Unfortunately, the other ecore models are quite complex so that
>>>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>>>> cannot use hibernate.
>>>>
>>>> How can I avoid mapping these unvanted ecore models?
>>>>
>>>> Regards
>>>> David
>>>
>>> --
>>>
>>> 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
>>
>>
>
>
> --
>
> 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] How to avoid mapping of transient EReferences? [message #100326 is a reply to message #100313] Tue, 30 October 2007 09:14 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Currently transient efeatures are still mapped because they can be part of a featuremap which is
handled later by the hibernate/jpox mapper.
There are two solutions which I can implement:
- do a better check if a feature is indeed part of a featuremap and only let these transient
features be mapped
- never map an efeature which has a manual transient annotation

In either case this is not solved until the next build. As I am pretty busy right now it will take a
few weeks before I can spend time on this.

If you are interested in a solution can you then enter a bugzilla for this (with a reference to this
newsthread)? Then I will pick it up in the next build.

For now you can override the efeatureannotator with your own efeatureannotator and the annotate
method to ignore transient features. You can plugin your own efeatureannotator using the
extensionmanager:
http://www.elver.org/hibernate/extensions.html

gr. Martin

David Skogan wrote:
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:fg3t08$ec9$1@build.eclipse.org...
>> Hi David,
>> The line is commented out on purpose (see the remark just above it). The
>> transient should be handled in the specific mapper (hibernate or jpox). So
>> for these efeatures the system (for hibernate) should end up in
>> BasicMapper.processTransient (which does not create a mapping for a
>> transient).
>>
>> When you debug does the system add a transient annotation to the efeature
>> (see arround line 104 in the EFeatureAnnotator)?
>
> Not after I annotated them with @Transient
>
>> I think I also see what your issue is: even if the ereference is
>> transient, it requires you to register the target eclasses with the
>> datastore, with as a result that they will be mapped also to the db (which
>> you don't want), correct?
>
> Exactly, I do not want them in the db at all. Any ideas of how to avoid
> this.
>
> David
>
>> gr. Martin
>>
>> David Skogan wrote:
>>> Hi Martin,
>>>
>>> I have debugged the code and my ereferences are found transient because
>>> they do not have any opposite, and there is no composition either. I have
>>> also, to be sure, added the following annotation to my references.
>>>
>>> <eAnnotations source="teneo.jpa">
>>>
>>> <details key="appinfo" value="@Transient"/>
>>>
>>> </eAnnotations>
>>>
>>> However, instead of ignoring the ereference the code goes on and insist
>>> on creating a manyToOneReferenceAnnotator mapping for my transient
>>> ereferences and thus require the target EClass to be registered. And it
>>> does not seem natural to annotate all target EClasses as transient
>>> either.
>>>
>>> In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method
>>> you have commented out
>>>
>>>
>>>
>>> // if (aStructuralFeature.getTransient() != null) return;
>>>
>>> Shouldn't this be uncommented and functional code. At least for plain
>>> ereferences.
>>>
>>> Regards
>>>
>>> David
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:ffqr67$c6d$1@build.eclipse.org...
>>>> Hi David,
>>>> The logic to determine if an ereference is transient has some particular
>>>> details:
>>>> Here is the part of the source code which determines this (see the
>>>> EFeatureAnnotator class):
>>>>
>>>> // a feature is transient if:
>>>> // - transient is true and it is an eattribute or
>>>> // - transient is true and it does not have an opposite
>>>> // - transietn is true and it's opposite is not a containment
>>>> // relation
>>>> // - it refers to an eclass which is transient
>>>> boolean isTransient =
>>>> eStructuralFeature.isTransient() &&
>>>> (eStructuralFeature instanceof EAttribute ||
>>>> ((EReference) eStructuralFeature).getEOpposite() == null ||
>>>> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
>>>> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>>>>
>>>> // check if the refered to eclass is transient if so then this efeature
>>>> is
>>>> // also transient
>>>> if (!isTransient && eStructuralFeature instanceof EReference) {
>>>> final PAnnotatedEReference aReference = (PAnnotatedEReference)
>>>> aStructuralFeature;
>>>> if (aReference.getAReferenceType() != null) {
>>>> isTransient = aReference.getAReferenceType().getTransient() != null;
>>>> }
>>>> }
>>>>
>>>> Does this apply to your ereferences?
>>>> You can always force transient by setting a Transient annotation to the
>>>> EReference.
>>>>
>>>> gr. Martin
>>>>
>>>> David Skogan wrote:
>>>>> Hi,
>>>>>
>>>>> I have an ecore file with EClasses that have transient EReferences to
>>>>> classes in other ecore files. In my main.ecore file I have many of the
>>>>> following:
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>>>>> eType="ecore:EClass some.ecore#//Breakdown_realization"
>>>>> transient="true">
>>>>>
>>>>> For some reason teneo insist on annotating/mapping these references.
>>>>> But I do not want that, I want teneo to ignore them. They are
>>>>> transient, and as I understand it transient is the oposit of
>>>>> persistent.
>>>>>
>>>>> Unfortunately, the other ecore models are quite complex so that
>>>>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>>>>> cannot use hibernate.
>>>>>
>>>>> How can I avoid mapping these unvanted ecore models?
>>>>>
>>>>> Regards
>>>>> David
>>>> --
>>>>
>>>> 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
>>>
>>
>> --
>>
>> 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
>
>


--

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] How to avoid mapping of transient EReferences? [message #610153 is a reply to message #100183] Thu, 25 October 2007 19:35 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
The logic to determine if an ereference is transient has some particular details:
Here is the part of the source code which determines this (see the EFeatureAnnotator class):

// a feature is transient if:
// - transient is true and it is an eattribute or
// - transient is true and it does not have an opposite
// - transietn is true and it's opposite is not a containment
// relation
// - it refers to an eclass which is transient
boolean isTransient =
eStructuralFeature.isTransient() &&
(eStructuralFeature instanceof EAttribute ||
((EReference) eStructuralFeature).getEOpposite() == null ||
!((EReference) eStructuralFeature).getEOpposite().isContainment() || ((EReference)
eStructuralFeature).getEOpposite().isTransient());

// check if the refered to eclass is transient if so then this efeature is
// also transient
if (!isTransient && eStructuralFeature instanceof EReference) {
final PAnnotatedEReference aReference = (PAnnotatedEReference) aStructuralFeature;
if (aReference.getAReferenceType() != null) {
isTransient = aReference.getAReferenceType().getTransient() != null;
}
}

Does this apply to your ereferences?
You can always force transient by setting a Transient annotation to the EReference.

gr. Martin

David Skogan wrote:
> Hi,
>
> I have an ecore file with EClasses that have transient EReferences to
> classes in other ecore files. In my main.ecore file I have many of the
> following:
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
> eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">
>
> For some reason teneo insist on annotating/mapping these references. But I
> do not want that, I want teneo to ignore them. They are transient, and as I
> understand it transient is the oposit of persistent.
>
> Unfortunately, the other ecore models are quite complex so that
> teneo/hibernate eats up all my available heap space (1024M). Hence, I cannot
> use hibernate.
>
> How can I avoid mapping these unvanted ecore models?
>
> Regards
> David
>
>


--

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] How to avoid mapping of transient EReferences? [message #610158 is a reply to message #100214] Fri, 26 October 2007 12:53 Go to previous message
Eclipse UserFriend
Originally posted by: david.skogan.gmail.com

Hi Martin,

I have debugged the code and my ereferences are found transient because they
do not have any opposite, and there is no composition either. I have also,
to be sure, added the following annotation to my references.

<eAnnotations source="teneo.jpa">

<details key="appinfo" value="@Transient"/>

</eAnnotations>

However, instead of ignoring the ereference the code goes on and insist on
creating a manyToOneReferenceAnnotator mapping for my transient ereferences
and thus require the target EClass to be registered. And it does not seem
natural to annotate all target EClasses as transient either.

In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method you
have commented out



// if (aStructuralFeature.getTransient() != null) return;

Shouldn't this be uncommented and functional code. At least for plain
ereferences.

Regards

David

"Martin Taal" <mtaal@elver.org> wrote in message
news:ffqr67$c6d$1@build.eclipse.org...
> Hi David,
> The logic to determine if an ereference is transient has some particular
> details:
> Here is the part of the source code which determines this (see the
> EFeatureAnnotator class):
>
> // a feature is transient if:
> // - transient is true and it is an eattribute or
> // - transient is true and it does not have an opposite
> // - transietn is true and it's opposite is not a containment
> // relation
> // - it refers to an eclass which is transient
> boolean isTransient =
> eStructuralFeature.isTransient() &&
> (eStructuralFeature instanceof EAttribute ||
> ((EReference) eStructuralFeature).getEOpposite() == null ||
> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>
> // check if the refered to eclass is transient if so then this efeature is
> // also transient
> if (!isTransient && eStructuralFeature instanceof EReference) {
> final PAnnotatedEReference aReference = (PAnnotatedEReference)
> aStructuralFeature;
> if (aReference.getAReferenceType() != null) {
> isTransient = aReference.getAReferenceType().getTransient() != null;
> }
> }
>
> Does this apply to your ereferences?
> You can always force transient by setting a Transient annotation to the
> EReference.
>
> gr. Martin
>
> David Skogan wrote:
>> Hi,
>>
>> I have an ecore file with EClasses that have transient EReferences to
>> classes in other ecore files. In my main.ecore file I have many of the
>> following:
>>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>> eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">
>>
>> For some reason teneo insist on annotating/mapping these references. But
>> I do not want that, I want teneo to ignore them. They are transient, and
>> as I understand it transient is the oposit of persistent.
>>
>> Unfortunately, the other ecore models are quite complex so that
>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>> cannot use hibernate.
>>
>> How can I avoid mapping these unvanted ecore models?
>>
>> Regards
>> David
>
>
> --
>
> 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] How to avoid mapping of transient EReferences? [message #610165 is a reply to message #100257] Mon, 29 October 2007 06:01 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
The line is commented out on purpose (see the remark just above it). The transient should be handled
in the specific mapper (hibernate or jpox). So for these efeatures the system (for hibernate) should
end up in BasicMapper.processTransient (which does not create a mapping for a transient).

When you debug does the system add a transient annotation to the efeature (see arround line 104 in
the EFeatureAnnotator)?

I think I also see what your issue is: even if the ereference is transient, it requires you to
register the target eclasses with the datastore, with as a result that they will be mapped also to
the db (which you don't want), correct?

gr. Martin

David Skogan wrote:
> Hi Martin,
>
> I have debugged the code and my ereferences are found transient because they
> do not have any opposite, and there is no composition either. I have also,
> to be sure, added the following annotation to my references.
>
> <eAnnotations source="teneo.jpa">
>
> <details key="appinfo" value="@Transient"/>
>
> </eAnnotations>
>
> However, instead of ignoring the ereference the code goes on and insist on
> creating a manyToOneReferenceAnnotator mapping for my transient ereferences
> and thus require the target EClass to be registered. And it does not seem
> natural to annotate all target EClasses as transient either.
>
> In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method you
> have commented out
>
>
>
> // if (aStructuralFeature.getTransient() != null) return;
>
> Shouldn't this be uncommented and functional code. At least for plain
> ereferences.
>
> Regards
>
> David
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:ffqr67$c6d$1@build.eclipse.org...
>> Hi David,
>> The logic to determine if an ereference is transient has some particular
>> details:
>> Here is the part of the source code which determines this (see the
>> EFeatureAnnotator class):
>>
>> // a feature is transient if:
>> // - transient is true and it is an eattribute or
>> // - transient is true and it does not have an opposite
>> // - transietn is true and it's opposite is not a containment
>> // relation
>> // - it refers to an eclass which is transient
>> boolean isTransient =
>> eStructuralFeature.isTransient() &&
>> (eStructuralFeature instanceof EAttribute ||
>> ((EReference) eStructuralFeature).getEOpposite() == null ||
>> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
>> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>>
>> // check if the refered to eclass is transient if so then this efeature is
>> // also transient
>> if (!isTransient && eStructuralFeature instanceof EReference) {
>> final PAnnotatedEReference aReference = (PAnnotatedEReference)
>> aStructuralFeature;
>> if (aReference.getAReferenceType() != null) {
>> isTransient = aReference.getAReferenceType().getTransient() != null;
>> }
>> }
>>
>> Does this apply to your ereferences?
>> You can always force transient by setting a Transient annotation to the
>> EReference.
>>
>> gr. Martin
>>
>> David Skogan wrote:
>>> Hi,
>>>
>>> I have an ecore file with EClasses that have transient EReferences to
>>> classes in other ecore files. In my main.ecore file I have many of the
>>> following:
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>>> eType="ecore:EClass some.ecore#//Breakdown_realization" transient="true">
>>>
>>> For some reason teneo insist on annotating/mapping these references. But
>>> I do not want that, I want teneo to ignore them. They are transient, and
>>> as I understand it transient is the oposit of persistent.
>>>
>>> Unfortunately, the other ecore models are quite complex so that
>>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>>> cannot use hibernate.
>>>
>>> How can I avoid mapping these unvanted ecore models?
>>>
>>> Regards
>>> David
>>
>> --
>>
>> 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
>
>


--

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] How to avoid mapping of transient EReferences? [message #610167 is a reply to message #100298] Tue, 30 October 2007 08:45 Go to previous message
Eclipse UserFriend
Originally posted by: david.skogan.gmail.com

"Martin Taal" <mtaal@elver.org> wrote in message
news:fg3t08$ec9$1@build.eclipse.org...
> Hi David,
> The line is commented out on purpose (see the remark just above it). The
> transient should be handled in the specific mapper (hibernate or jpox). So
> for these efeatures the system (for hibernate) should end up in
> BasicMapper.processTransient (which does not create a mapping for a
> transient).
>
> When you debug does the system add a transient annotation to the efeature
> (see arround line 104 in the EFeatureAnnotator)?

Not after I annotated them with @Transient

>
> I think I also see what your issue is: even if the ereference is
> transient, it requires you to register the target eclasses with the
> datastore, with as a result that they will be mapped also to the db (which
> you don't want), correct?

Exactly, I do not want them in the db at all. Any ideas of how to avoid
this.

David

>
> gr. Martin
>
> David Skogan wrote:
>> Hi Martin,
>>
>> I have debugged the code and my ereferences are found transient because
>> they do not have any opposite, and there is no composition either. I have
>> also, to be sure, added the following annotation to my references.
>>
>> <eAnnotations source="teneo.jpa">
>>
>> <details key="appinfo" value="@Transient"/>
>>
>> </eAnnotations>
>>
>> However, instead of ignoring the ereference the code goes on and insist
>> on creating a manyToOneReferenceAnnotator mapping for my transient
>> ereferences and thus require the target EClass to be registered. And it
>> does not seem natural to annotate all target EClasses as transient
>> either.
>>
>> In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method
>> you have commented out
>>
>>
>>
>> // if (aStructuralFeature.getTransient() != null) return;
>>
>> Shouldn't this be uncommented and functional code. At least for plain
>> ereferences.
>>
>> Regards
>>
>> David
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:ffqr67$c6d$1@build.eclipse.org...
>>> Hi David,
>>> The logic to determine if an ereference is transient has some particular
>>> details:
>>> Here is the part of the source code which determines this (see the
>>> EFeatureAnnotator class):
>>>
>>> // a feature is transient if:
>>> // - transient is true and it is an eattribute or
>>> // - transient is true and it does not have an opposite
>>> // - transietn is true and it's opposite is not a containment
>>> // relation
>>> // - it refers to an eclass which is transient
>>> boolean isTransient =
>>> eStructuralFeature.isTransient() &&
>>> (eStructuralFeature instanceof EAttribute ||
>>> ((EReference) eStructuralFeature).getEOpposite() == null ||
>>> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
>>> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>>>
>>> // check if the refered to eclass is transient if so then this efeature
>>> is
>>> // also transient
>>> if (!isTransient && eStructuralFeature instanceof EReference) {
>>> final PAnnotatedEReference aReference = (PAnnotatedEReference)
>>> aStructuralFeature;
>>> if (aReference.getAReferenceType() != null) {
>>> isTransient = aReference.getAReferenceType().getTransient() != null;
>>> }
>>> }
>>>
>>> Does this apply to your ereferences?
>>> You can always force transient by setting a Transient annotation to the
>>> EReference.
>>>
>>> gr. Martin
>>>
>>> David Skogan wrote:
>>>> Hi,
>>>>
>>>> I have an ecore file with EClasses that have transient EReferences to
>>>> classes in other ecore files. In my main.ecore file I have many of the
>>>> following:
>>>>
>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>>>> eType="ecore:EClass some.ecore#//Breakdown_realization"
>>>> transient="true">
>>>>
>>>> For some reason teneo insist on annotating/mapping these references.
>>>> But I do not want that, I want teneo to ignore them. They are
>>>> transient, and as I understand it transient is the oposit of
>>>> persistent.
>>>>
>>>> Unfortunately, the other ecore models are quite complex so that
>>>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>>>> cannot use hibernate.
>>>>
>>>> How can I avoid mapping these unvanted ecore models?
>>>>
>>>> Regards
>>>> David
>>>
>>> --
>>>
>>> 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
>>
>>
>
>
> --
>
> 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] How to avoid mapping of transient EReferences? [message #610168 is a reply to message #100313] Tue, 30 October 2007 09:14 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Currently transient efeatures are still mapped because they can be part of a featuremap which is
handled later by the hibernate/jpox mapper.
There are two solutions which I can implement:
- do a better check if a feature is indeed part of a featuremap and only let these transient
features be mapped
- never map an efeature which has a manual transient annotation

In either case this is not solved until the next build. As I am pretty busy right now it will take a
few weeks before I can spend time on this.

If you are interested in a solution can you then enter a bugzilla for this (with a reference to this
newsthread)? Then I will pick it up in the next build.

For now you can override the efeatureannotator with your own efeatureannotator and the annotate
method to ignore transient features. You can plugin your own efeatureannotator using the
extensionmanager:
http://www.elver.org/hibernate/extensions.html

gr. Martin

David Skogan wrote:
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:fg3t08$ec9$1@build.eclipse.org...
>> Hi David,
>> The line is commented out on purpose (see the remark just above it). The
>> transient should be handled in the specific mapper (hibernate or jpox). So
>> for these efeatures the system (for hibernate) should end up in
>> BasicMapper.processTransient (which does not create a mapping for a
>> transient).
>>
>> When you debug does the system add a transient annotation to the efeature
>> (see arround line 104 in the EFeatureAnnotator)?
>
> Not after I annotated them with @Transient
>
>> I think I also see what your issue is: even if the ereference is
>> transient, it requires you to register the target eclasses with the
>> datastore, with as a result that they will be mapped also to the db (which
>> you don't want), correct?
>
> Exactly, I do not want them in the db at all. Any ideas of how to avoid
> this.
>
> David
>
>> gr. Martin
>>
>> David Skogan wrote:
>>> Hi Martin,
>>>
>>> I have debugged the code and my ereferences are found transient because
>>> they do not have any opposite, and there is no composition either. I have
>>> also, to be sure, added the following annotation to my references.
>>>
>>> <eAnnotations source="teneo.jpa">
>>>
>>> <details key="appinfo" value="@Transient"/>
>>>
>>> </eAnnotations>
>>>
>>> However, instead of ignoring the ereference the code goes on and insist
>>> on creating a manyToOneReferenceAnnotator mapping for my transient
>>> ereferences and thus require the target EClass to be registered. And it
>>> does not seem natural to annotate all target EClasses as transient
>>> either.
>>>
>>> In the annotate(PAnnotatedEStructuralFeature aStructuralFeature) method
>>> you have commented out
>>>
>>>
>>>
>>> // if (aStructuralFeature.getTransient() != null) return;
>>>
>>> Shouldn't this be uncommented and functional code. At least for plain
>>> ereferences.
>>>
>>> Regards
>>>
>>> David
>>>
>>> "Martin Taal" <mtaal@elver.org> wrote in message
>>> news:ffqr67$c6d$1@build.eclipse.org...
>>>> Hi David,
>>>> The logic to determine if an ereference is transient has some particular
>>>> details:
>>>> Here is the part of the source code which determines this (see the
>>>> EFeatureAnnotator class):
>>>>
>>>> // a feature is transient if:
>>>> // - transient is true and it is an eattribute or
>>>> // - transient is true and it does not have an opposite
>>>> // - transietn is true and it's opposite is not a containment
>>>> // relation
>>>> // - it refers to an eclass which is transient
>>>> boolean isTransient =
>>>> eStructuralFeature.isTransient() &&
>>>> (eStructuralFeature instanceof EAttribute ||
>>>> ((EReference) eStructuralFeature).getEOpposite() == null ||
>>>> !((EReference) eStructuralFeature).getEOpposite().isContainment() ||
>>>> ((EReference) eStructuralFeature).getEOpposite().isTransient());
>>>>
>>>> // check if the refered to eclass is transient if so then this efeature
>>>> is
>>>> // also transient
>>>> if (!isTransient && eStructuralFeature instanceof EReference) {
>>>> final PAnnotatedEReference aReference = (PAnnotatedEReference)
>>>> aStructuralFeature;
>>>> if (aReference.getAReferenceType() != null) {
>>>> isTransient = aReference.getAReferenceType().getTransient() != null;
>>>> }
>>>> }
>>>>
>>>> Does this apply to your ereferences?
>>>> You can always force transient by setting a Transient annotation to the
>>>> EReference.
>>>>
>>>> gr. Martin
>>>>
>>>> David Skogan wrote:
>>>>> Hi,
>>>>>
>>>>> I have an ecore file with EClasses that have transient EReferences to
>>>>> classes in other ecore files. In my main.ecore file I have many of the
>>>>> following:
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="e1"
>>>>> eType="ecore:EClass some.ecore#//Breakdown_realization"
>>>>> transient="true">
>>>>>
>>>>> For some reason teneo insist on annotating/mapping these references.
>>>>> But I do not want that, I want teneo to ignore them. They are
>>>>> transient, and as I understand it transient is the oposit of
>>>>> persistent.
>>>>>
>>>>> Unfortunately, the other ecore models are quite complex so that
>>>>> teneo/hibernate eats up all my available heap space (1024M). Hence, I
>>>>> cannot use hibernate.
>>>>>
>>>>> How can I avoid mapping these unvanted ecore models?
>>>>>
>>>>> Regards
>>>>> David
>>>> --
>>>>
>>>> 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
>>>
>>
>> --
>>
>> 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
>
>


--

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
Previous Topic:Generating code for OCL annotations in OCL 1.0.1/EMF 2.2
Next Topic:[Teneo]foreign key element in jdo not generated properly?
Goto Forum:
  


Current Time: Sun Apr 14 02:12:00 GMT 2024

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

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

Back to the top