Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Problem with GenericGenerator annotation
Problem with GenericGenerator annotation [message #116294] Fri, 28 March 2008 09:14 Go to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

first I want to thank you for the hint with the @Basic annotation.

But now I need help with another annotation.
I like to have my ids generated with the hibernate uuid generator.
So I made an annotation to the property I also marked as id:

<eStructuralFeatures xsi:type="ecore:EAttribute" name="logicKey"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
iD="true">
<eAnnotations source="teneo.jpa">
<details key="appinfo"
value="@GenericGenerator(name=&quot;uuidgen&quot;
strategy=&quot;uuid&quot;) "/>
</eAnnotations>
</eStructuralFeatures>

During the mapping generation the following error occurs:

org.eclipse.emf.teneo.annotations.parser.AnnotationParserExc eption: The
eclass: HbAnnotatedEAttribute does not have an efeature for
GenericGenerator
at
org.eclipse.emf.teneo.annotations.parser.EAnnotationParserIm porter.processAnnotatedModelElement(EAnnotationParserImporte r.java:130)

The error message says that I have put the annotation at the wrong place,
but where do I have to put it? I've tried the class itself, but an
equivalent error occured.

Can you help me once more?

greetings
Manfred
Re: Problem with GenericGenerator annotation [message #116302 is a reply to message #116294] Fri, 28 March 2008 09:24 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050400040203020404080107
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi Manfred,
The GenericGenerator is specified at EPackage level.

I have attached an example from the Teneo testcases.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> first I want to thank you for the hint with the @Basic annotation.
>
> But now I need help with another annotation.
> I like to have my ids generated with the hibernate uuid generator.
> So I made an annotation to the property I also marked as id:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="logicKey"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
> iD="true">
> <eAnnotations source="teneo.jpa">
> <details key="appinfo"
> value="@GenericGenerator(name=&quot;uuidgen&quot;
> strategy=&quot;uuid&quot;) "/>
> </eAnnotations>
> </eStructuralFeatures>
>
> During the mapping generation the following error occurs:
>
> org.eclipse.emf.teneo.annotations.parser.AnnotationParserExc eption: The
> eclass: HbAnnotatedEAttribute does not have an efeature for
> GenericGenerator
> at
> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserIm porter.processAnnotatedModelElement(EAnnotationParserImporte r.java:130)
>
>
> The error message says that I have put the annotation at the wrong
> place, but where do I have to put it? I've tried the class itself, but
> an equivalent error occured.
>
> Can you help me once more?
>
> greetings Manfred
>


--

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

--------------050400040203020404080107
Content-Type: text/xml;
name="id.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="id.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="id"
nsURI=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
nsPrefix="id">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;@GenericGenerator(name=& amp;quot;system-uuid&quot;, strategy = &quot;uuid&quot;)&#xA;&#x9;&#x9;&#x9 ;@GenericGenerator(name=&quot;hibseq&quot;, strategy = &quot;hilo&quot;, parameters = {&#xA;&#x9;&#x9;&#x9;@Parameter(name=&qu ot;table&quot;, value = &quot;hilo_table&quot;), @Parameter(name=&quot;column&quot;,&#xA;&#x9 ;&#x9;&#x9;value=&quot;the_hilo_column&quot; ) } )&#xA;&#x9;&#x9;"/>
</eAnnotations>
<eClassifiers xsi:type="ecore:EClass" name="IdentityID">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="IdentityID"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="myid" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long"
unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&# x9;@Id @GeneratedValue(strategy=&quot;IDENTITY&quot;)&# xA;&#x9;&#x9;&#x9;&#x9;&#x9; "/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="myid"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SimpleID">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="SimpleID"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="autoID" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long" unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&# x9;@Id @GeneratedValue @Column(name=&quot;AUTOD&quot; nullable=&quot;false&quot;)&#xA;&#x9;&#x 9;&#x9;&#x9;&#x9; "/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="autoID"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="generated" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long" unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value="@Generated(ALWAYS)"/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="generated"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TableID">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="TableID"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="myid" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long"
unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&# x9;@Id @GeneratedValue(generator=&quot;hibseq&quot;)&#x A;&#x9;&#x9;&#x9;&#x9;&#x9; "/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="myid"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>

--------------050400040203020404080107
Content-Type: text/xml;
name="id.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="id.xsd"

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
xmlns=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:lib=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@GenericGenerator(name="system-uuid", strategy = "uuid")
@GenericGenerator(name="hibseq", strategy = "hilo", parameters = {
@Parameter(name="table", value = "hilo_table"), @Parameter(name="column",
value="the_hilo_column") } )
</xsd:appinfo>
</xsd:annotation>

<xsd:complexType name="SimpleID">
<xsd:sequence>
<xsd:element name="autoID" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@Id @GeneratedValue @Column(name="AUTOD" nullable="false")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="generated" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">@Generated(ALWAYS)</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableID">
<xsd:sequence>
<xsd:element name="myid" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@Id @GeneratedValue(generator="hibseq")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="IdentityID">
<xsd:sequence>
<xsd:element name="myid" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@Id @GeneratedValue(strategy="IDENTITY")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

--------------050400040203020404080107--
Re: Problem with GenericGenerator annotation [message #616023 is a reply to message #116294] Fri, 28 March 2008 09:24 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050400040203020404080107
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi Manfred,
The GenericGenerator is specified at EPackage level.

I have attached an example from the Teneo testcases.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> first I want to thank you for the hint with the @Basic annotation.
>
> But now I need help with another annotation.
> I like to have my ids generated with the hibernate uuid generator.
> So I made an annotation to the property I also marked as id:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="logicKey"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
> iD="true">
> <eAnnotations source="teneo.jpa">
> <details key="appinfo"
> value="@GenericGenerator(name=&quot;uuidgen&quot;
> strategy=&quot;uuid&quot;) "/>
> </eAnnotations>
> </eStructuralFeatures>
>
> During the mapping generation the following error occurs:
>
> org.eclipse.emf.teneo.annotations.parser.AnnotationParserExc eption: The
> eclass: HbAnnotatedEAttribute does not have an efeature for
> GenericGenerator
> at
> org.eclipse.emf.teneo.annotations.parser.EAnnotationParserIm porter.processAnnotatedModelElement(EAnnotationParserImporte r.java:130)
>
>
> The error message says that I have put the annotation at the wrong
> place, but where do I have to put it? I've tried the class itself, but
> an equivalent error occured.
>
> Can you help me once more?
>
> greetings Manfred
>


--

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

--------------050400040203020404080107
Content-Type: text/xml;
name="id.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="id.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="id"
nsURI=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
nsPrefix="id">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;@GenericGenerator(name=& amp;quot;system-uuid&quot;, strategy = &quot;uuid&quot;)&#xA;&#x9;&#x9;&#x9 ;@GenericGenerator(name=&quot;hibseq&quot;, strategy = &quot;hilo&quot;, parameters = {&#xA;&#x9;&#x9;&#x9;@Parameter(name=&qu ot;table&quot;, value = &quot;hilo_table&quot;), @Parameter(name=&quot;column&quot;,&#xA;&#x9 ;&#x9;&#x9;value=&quot;the_hilo_column&quot; ) } )&#xA;&#x9;&#x9;"/>
</eAnnotations>
<eClassifiers xsi:type="ecore:EClass" name="IdentityID">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="IdentityID"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="myid" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long"
unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&# x9;@Id @GeneratedValue(strategy=&quot;IDENTITY&quot;)&# xA;&#x9;&#x9;&#x9;&#x9;&#x9; "/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="myid"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SimpleID">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="SimpleID"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="autoID" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long" unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&# x9;@Id @GeneratedValue @Column(name=&quot;AUTOD&quot; nullable=&quot;false&quot;)&#xA;&#x9;&#x 9;&#x9;&#x9;&#x9; "/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="autoID"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="generated" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long" unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value="@Generated(ALWAYS)"/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="generated"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TableID">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="TableID"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="myid" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Long"
unsettable="true">
<eAnnotations source="teneo.hibernate">
<details key="appinfo" value=" &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&# x9;@Id @GeneratedValue(generator=&quot;hibseq&quot;)&#x A;&#x9;&#x9;&#x9;&#x9;&#x9; "/>
</eAnnotations>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="myid"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>

--------------050400040203020404080107
Content-Type: text/xml;
name="id.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="id.xsd"

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
xmlns=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:lib=" http://www.eclipse.org/emf/teneo/samples/emf/annotations/hb/ generator/id"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@GenericGenerator(name="system-uuid", strategy = "uuid")
@GenericGenerator(name="hibseq", strategy = "hilo", parameters = {
@Parameter(name="table", value = "hilo_table"), @Parameter(name="column",
value="the_hilo_column") } )
</xsd:appinfo>
</xsd:annotation>

<xsd:complexType name="SimpleID">
<xsd:sequence>
<xsd:element name="autoID" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@Id @GeneratedValue @Column(name="AUTOD" nullable="false")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="generated" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">@Generated(ALWAYS)</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableID">
<xsd:sequence>
<xsd:element name="myid" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@Id @GeneratedValue(generator="hibseq")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="IdentityID">
<xsd:sequence>
<xsd:element name="myid" type="xsd:long">
<xsd:annotation>
<xsd:appinfo source="teneo.hibernate">
@Id @GeneratedValue(strategy="IDENTITY")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

--------------050400040203020404080107--
Previous Topic:Problem with GenericGenerator annotation
Next Topic:Teneo resources and the EMF Validation framework do not properly work together
Goto Forum:
  


Current Time: Thu Apr 25 18:02:11 GMT 2024

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

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

Back to the top