Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Problem with GenericGenerator annotation
|
Re: Problem with GenericGenerator annotation [message #116302 is a reply to message #116294] |
Fri, 28 March 2008 09:24 |
Martin Taal 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="uuidgen"
> strategy="uuid") "/>
> </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=" 
			@GenericGenerator(name=& amp;quot;system-uuid", strategy = "uuid")
			 ;@GenericGenerator(name="hibseq", strategy = "hilo", parameters = {
			@Parameter(name=&qu ot;table", value = "hilo_table"), @Parameter(name="column",
	 ;		value="the_hilo_column" ) } )
		"/>
</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=" 
					&# x9;@Id @GeneratedValue(strategy="IDENTITY")&# xA;					 "/>
</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=" 
					&# x9;@Id @GeneratedValue @Column(name="AUTOD" nullable="false")
	&#x 9;			 "/>
</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=" 
					&# x9;@Id @GeneratedValue(generator="hibseq")&#x A;					 "/>
</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 |
Martin Taal 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="uuidgen"
> strategy="uuid") "/>
> </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=" 
			@GenericGenerator(name=& amp;quot;system-uuid", strategy = "uuid")
			 ;@GenericGenerator(name="hibseq", strategy = "hilo", parameters = {
			@Parameter(name=&qu ot;table", value = "hilo_table"), @Parameter(name="column",
	 ;		value="the_hilo_column" ) } )
		"/>
</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=" 
					&# x9;@Id @GeneratedValue(strategy="IDENTITY")&# xA;					 "/>
</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=" 
					&# x9;@Id @GeneratedValue @Column(name="AUTOD" nullable="false")
	&#x 9;			 "/>
</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=" 
					&# x9;@Id @GeneratedValue(generator="hibseq")&#x A;					 "/>
</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--
|
|
|
Goto Forum:
Current Time: Thu Apr 25 18:02:11 GMT 2024
Powered by FUDForum. Page generated in 5.03888 seconds
|