Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Setting Id generator from ecore file
[Teneo] Setting Id generator from ecore file [message #65217] Wed, 20 December 2006 23:08 Go to next message
Eclipse UserFriend
Originally posted by: g.idema.zonnet.nl

Before I switched to the latest Teneo build, I used the following annotation
on my ID attributes to set the generator in the hibernate mapping:

<eAnnotations source="http://hibernate.elver.org/GeneratedValue">

<details key="strategy" value="AUTO"/>

</eAnnotations>

In the latest build, I don't get the <generator> element in the hibenate
mapping anymore.

Any suggestions as for what I'm doing wrong?

Gertjan Idema
Re: [Teneo] Setting Id generator from ecore file [message #65259 is a reply to message #65217] Thu, 21 December 2006 04:36 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The source of the annotation changed a few months ago:
http://www.elver.org/hibernate/ejb3_format.html

gr. Martin

Gertjan Idema wrote:
> Before I switched to the latest Teneo build, I used the following annotation
> on my ID attributes to set the generator in the hibernate mapping:
>
> <eAnnotations source="http://hibernate.elver.org/GeneratedValue">
>
> <details key="strategy" value="AUTO"/>
>
> </eAnnotations>
>
> In the latest build, I don't get the <generator> element in the hibenate
> mapping anymore.
>
> Any suggestions as for what I'm doing wrong?
>
> Gertjan Idema
>
>


--

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] Setting Id generator from ecore file [message #65362 is a reply to message #65259] Thu, 21 December 2006 15:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.idema.zonnet.nl

Hi Martin,

Thanks. I changed the annotation to the following and it work as expected:

<eAnnotations source="teneo.jpa/Id">
<details key="appinfo" value="@GeneratedValue(strategy=&quot;AUTO&quot;)"/ >
</eAnnotations>

However if I attach this annotation to an EDataType and use this for the id
attributes in all of my classes, this only work for the first class in the
package. For example, if I have two classes Foo, Bar in my package, both
with an id attribute of EDataType ID, where ID is annotated as shown above.
Then when I create the hibernate mapping, only class Foo gets the <generator
class="native"/> element.
Switching the order of the classes in the package to Bar, Foo results in
only class Bar having the <generator class="native"/> element instead.

I decided to dig into this issue and found the following:
The GeneratedValue attribute is contained in the HbAnnotatedEDataType Class,
as are the other annotation attributes.
Therefore the first call to "pea.eSet(asf, ped.eGet(esf));" in the
PersistenceMappingBuilder removes the value from the HbAnnotatedEDataType
instance, preventing it from being copied the next time.

I suggest the following fix:

replace "pea.eSet(asf, ped.eGet(esf));" with "pea.eSet(asf,
EcoreUtil.copy(ped.eGet(esf)));"

Gertjan Idema

"Martin Taal" <mtaal@elver.org> wrote in message
news:emd30s$fk9$1@utils.eclipse.org...
> The source of the annotation changed a few months ago:
> http://www.elver.org/hibernate/ejb3_format.html
>
> gr. Martin
>
> Gertjan Idema wrote:
>> Before I switched to the latest Teneo build, I used the following
>> annotation on my ID attributes to set the generator in the hibernate
>> mapping:
>>
>> <eAnnotations source="http://hibernate.elver.org/GeneratedValue">
>>
>> <details key="strategy" value="AUTO"/>
>>
>> </eAnnotations>
>>
>> In the latest build, I don't get the <generator> element in the hibenate
>> mapping anymore.
>>
>> Any suggestions as for what I'm doing wrong?
>>
>> Gertjan Idema
>>
>>
>
>
> --
>
> 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] Setting Id generator from ecore file [message #65405 is a reply to message #65362] Thu, 21 December 2006 15:47 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Thanks GertJan for researching the cause of this.

I committed a solution similar to your proposal.

gr. Martin

Gertjan Idema wrote:
> Hi Martin,
>
> Thanks. I changed the annotation to the following and it work as expected:
>
> <eAnnotations source="teneo.jpa/Id">
> <details key="appinfo" value="@GeneratedValue(strategy=&quot;AUTO&quot;)"/ >
> </eAnnotations>
>
> However if I attach this annotation to an EDataType and use this for the id
> attributes in all of my classes, this only work for the first class in the
> package. For example, if I have two classes Foo, Bar in my package, both
> with an id attribute of EDataType ID, where ID is annotated as shown above.
> Then when I create the hibernate mapping, only class Foo gets the <generator
> class="native"/> element.
> Switching the order of the classes in the package to Bar, Foo results in
> only class Bar having the <generator class="native"/> element instead.
>
> I decided to dig into this issue and found the following:
> The GeneratedValue attribute is contained in the HbAnnotatedEDataType Class,
> as are the other annotation attributes.
> Therefore the first call to "pea.eSet(asf, ped.eGet(esf));" in the
> PersistenceMappingBuilder removes the value from the HbAnnotatedEDataType
> instance, preventing it from being copied the next time.
>
> I suggest the following fix:
>
> replace "pea.eSet(asf, ped.eGet(esf));" with "pea.eSet(asf,
> EcoreUtil.copy(ped.eGet(esf)));"
>
> Gertjan Idema
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:emd30s$fk9$1@utils.eclipse.org...
>> The source of the annotation changed a few months ago:
>> http://www.elver.org/hibernate/ejb3_format.html
>>
>> gr. Martin
>>
>> Gertjan Idema wrote:
>>> Before I switched to the latest Teneo build, I used the following
>>> annotation on my ID attributes to set the generator in the hibernate
>>> mapping:
>>>
>>> <eAnnotations source="http://hibernate.elver.org/GeneratedValue">
>>>
>>> <details key="strategy" value="AUTO"/>
>>>
>>> </eAnnotations>
>>>
>>> In the latest build, I don't get the <generator> element in the hibenate
>>> mapping anymore.
>>>
>>> Any suggestions as for what I'm doing wrong?
>>>
>>> Gertjan Idema
>>>
>>>
>>
>> --
>>
>> 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] Setting Id generator from ecore file [message #597260 is a reply to message #65217] Thu, 21 December 2006 04:36 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The source of the annotation changed a few months ago:
http://www.elver.org/hibernate/ejb3_format.html

gr. Martin

Gertjan Idema wrote:
> Before I switched to the latest Teneo build, I used the following annotation
> on my ID attributes to set the generator in the hibernate mapping:
>
> <eAnnotations source="http://hibernate.elver.org/GeneratedValue">
>
> <details key="strategy" value="AUTO"/>
>
> </eAnnotations>
>
> In the latest build, I don't get the <generator> element in the hibenate
> mapping anymore.
>
> Any suggestions as for what I'm doing wrong?
>
> Gertjan Idema
>
>


--

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] Setting Id generator from ecore file [message #597312 is a reply to message #65259] Thu, 21 December 2006 15:14 Go to previous message
Eclipse UserFriend
Originally posted by: g.idema.zonnet.nl

Hi Martin,

Thanks. I changed the annotation to the following and it work as expected:

<eAnnotations source="teneo.jpa/Id">
<details key="appinfo" value="@GeneratedValue(strategy=&quot;AUTO&quot;)"/ >
</eAnnotations>

However if I attach this annotation to an EDataType and use this for the id
attributes in all of my classes, this only work for the first class in the
package. For example, if I have two classes Foo, Bar in my package, both
with an id attribute of EDataType ID, where ID is annotated as shown above.
Then when I create the hibernate mapping, only class Foo gets the <generator
class="native"/> element.
Switching the order of the classes in the package to Bar, Foo results in
only class Bar having the <generator class="native"/> element instead.

I decided to dig into this issue and found the following:
The GeneratedValue attribute is contained in the HbAnnotatedEDataType Class,
as are the other annotation attributes.
Therefore the first call to "pea.eSet(asf, ped.eGet(esf));" in the
PersistenceMappingBuilder removes the value from the HbAnnotatedEDataType
instance, preventing it from being copied the next time.

I suggest the following fix:

replace "pea.eSet(asf, ped.eGet(esf));" with "pea.eSet(asf,
EcoreUtil.copy(ped.eGet(esf)));"

Gertjan Idema

"Martin Taal" <mtaal@elver.org> wrote in message
news:emd30s$fk9$1@utils.eclipse.org...
> The source of the annotation changed a few months ago:
> http://www.elver.org/hibernate/ejb3_format.html
>
> gr. Martin
>
> Gertjan Idema wrote:
>> Before I switched to the latest Teneo build, I used the following
>> annotation on my ID attributes to set the generator in the hibernate
>> mapping:
>>
>> <eAnnotations source="http://hibernate.elver.org/GeneratedValue">
>>
>> <details key="strategy" value="AUTO"/>
>>
>> </eAnnotations>
>>
>> In the latest build, I don't get the <generator> element in the hibenate
>> mapping anymore.
>>
>> Any suggestions as for what I'm doing wrong?
>>
>> Gertjan Idema
>>
>>
>
>
> --
>
> 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] Setting Id generator from ecore file [message #600185 is a reply to message #65362] Thu, 21 December 2006 15:47 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Thanks GertJan for researching the cause of this.

I committed a solution similar to your proposal.

gr. Martin

Gertjan Idema wrote:
> Hi Martin,
>
> Thanks. I changed the annotation to the following and it work as expected:
>
> <eAnnotations source="teneo.jpa/Id">
> <details key="appinfo" value="@GeneratedValue(strategy=&quot;AUTO&quot;)"/ >
> </eAnnotations>
>
> However if I attach this annotation to an EDataType and use this for the id
> attributes in all of my classes, this only work for the first class in the
> package. For example, if I have two classes Foo, Bar in my package, both
> with an id attribute of EDataType ID, where ID is annotated as shown above.
> Then when I create the hibernate mapping, only class Foo gets the <generator
> class="native"/> element.
> Switching the order of the classes in the package to Bar, Foo results in
> only class Bar having the <generator class="native"/> element instead.
>
> I decided to dig into this issue and found the following:
> The GeneratedValue attribute is contained in the HbAnnotatedEDataType Class,
> as are the other annotation attributes.
> Therefore the first call to "pea.eSet(asf, ped.eGet(esf));" in the
> PersistenceMappingBuilder removes the value from the HbAnnotatedEDataType
> instance, preventing it from being copied the next time.
>
> I suggest the following fix:
>
> replace "pea.eSet(asf, ped.eGet(esf));" with "pea.eSet(asf,
> EcoreUtil.copy(ped.eGet(esf)));"
>
> Gertjan Idema
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:emd30s$fk9$1@utils.eclipse.org...
>> The source of the annotation changed a few months ago:
>> http://www.elver.org/hibernate/ejb3_format.html
>>
>> gr. Martin
>>
>> Gertjan Idema wrote:
>>> Before I switched to the latest Teneo build, I used the following
>>> annotation on my ID attributes to set the generator in the hibernate
>>> mapping:
>>>
>>> <eAnnotations source="http://hibernate.elver.org/GeneratedValue">
>>>
>>> <details key="strategy" value="AUTO"/>
>>>
>>> </eAnnotations>
>>>
>>> In the latest build, I don't get the <generator> element in the hibenate
>>> mapping anymore.
>>>
>>> Any suggestions as for what I'm doing wrong?
>>>
>>> Gertjan Idema
>>>
>>>
>>
>> --
>>
>> 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:Teneo - I loose my EObject fields
Next Topic:teneo - Performance penalty for larger models in HibernateResource
Goto Forum:
  


Current Time: Fri Apr 19 14:56:06 GMT 2024

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

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

Back to the top