Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Entity JPA Annotation Issue(0...* attributes not picking up @Entity)
[Teneo] Entity JPA Annotation Issue [message #1007378] Tue, 05 February 2013 11:39 Go to next message
Rob Mising name is currently offline Rob Mising name
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

I have come across a small problem I would be grateful if you could cast you expert eyes over.

I have an eCore:

  <eClassifiers xsi:type="ecore:EClass" name="Case1">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Case1"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eAnnotations source="teneo.jpa">
      <details key="value" value="@Table(name=&quot;ROBTEST_CASE1&quot;)&#xA;@Entity(name=&quot;com.example.robtest.Case1&quot;)&#xA;@DiscriminatorValue(&quot;com.example.robtest.Case1&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="case2" upperBound="-1" eType="//Case2" eOpposite="//Case2/case1">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case2"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@JoinTable(name=&quot;ROBTEST_CASE1_CASE2&quot;)&#xA;@Column(name=&quot;CASE2&quot;)&#xA;@ForeignKey(name=&quot;CASE1_CASE2&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Id&#xA;@Column(name=&quot;BDS_ID&quot;, nullable=&quot;false&quot;)"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;BDS_VERSION&quot;)&#xA;@Version"/>
      </eAnnotations>
      <eAnnotations source="bds">
        <details key="isVersion" value="true"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="Case2">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Case2"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eAnnotations source="teneo.jpa">
      <details key="value" value="@Table(name=&quot;ROBTEST_CASE2&quot;)&#xA;@Entity(name=&quot;com.example.robtest.Case2&quot;)&#xA;@DiscriminatorValue(&quot;com.example.robtest.Case2&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="case1" eType="//Case1" eOpposite="//Case1/case2">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="case1"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;CASE1&quot;)&#xA;@ForeignKey(name=&quot;CASE2_CASE1&quot;)"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Id&#xA;@Column(name=&quot;BDS_ID&quot;, nullable=&quot;false&quot;)"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion">
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;BDS_VERSION&quot;)&#xA;@Version"/>
      </eAnnotations>
      <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
    </eStructuralFeatures>
  </eClassifiers>


I suppose the key bit is that I have the @Entity annotation set on the Class1 and Class2 EClass

However, when it generates the Hibernate mapping it looks as follows:

<class entity-name="com.example.robtest.Case1" abstract="false" lazy="false" discriminator-value="com.example.robtest.Case1" table="`BDS_1_ROBTEST_CASE1`">
	<meta attribute="eclassName">Case1</meta>
	<meta attribute="epackage">http://example.com/robtest</meta>
	<id name="bdsId" type="java.lang.Long">
		<column not-null="true" unique="false" name="`BDS_ID`"/>
	</id>
	<discriminator column="`DTYPE`" type="string"/>
	<version name="bdsVersion" type="java.lang.Long">
		<column not-null="false" unique="false" name="`BDS_VERSION`"/>
	</version>
	<list name="case2" table="`BDS_1_ROBTEST_CASE1CASE2`" lazy="true">
		<key foreign-key="FK_1_ROBTEST_CASE21" update="true">
			<column name="`CASE1_BDSID`" not-null="true" unique="false"/>
		</key>
		<list-index column="`CASE1_CASE2_IDX`"/>
		<many-to-many entity-name="robtest.Case2" unique="true" foreign-key="FK_1_ROBTEST_CASE2">
			<column name="`CASE2_BDSID`" not-null="true" unique="false"/>
		</many-to-many>
	</list>
</class>
<class entity-name="com.example.robtest.Case2" abstract="false" lazy="false" discriminator-value="com.example.robtest.Case2" table="`BDS_1_ROBTEST_CASE2`">
	<meta attribute="eclassName">Case2</meta>
	<meta attribute="epackage">http://example.com/robtest</meta>
	<id name="bdsId" type="java.lang.Long">
		<column not-null="true" unique="false" name="`BDS_ID`"/>
	</id>
	<discriminator column="`DTYPE`" type="string"/>
	<version name="bdsVersion" type="java.lang.Long">
		<column not-null="false" unique="false" name="`BDS_VERSION`"/>
	</version>
	<many-to-one name="case1" entity-name="robtest.Case1" lazy="false" foreign-key="FK_1_ROBTEST_CASE1" insert="true" update="true" not-null="false">
		<column not-null="false" unique="false" name="`CASE2_CASE1_BDSID`"/>
	</many-to-one>
</class>


In this case it generates the entity for the classes OK ("com.example.robtest.Case2"), but the references to it are not picking up on that entity name, instead using entity-name="robtest.Case2".

Any thoughts or assistance yould be a great help.

Thanks

Rob

[Updated on: Wed, 06 February 2013 06:54]

Report message to a moderator

Re: [Teneo] Entity JPA Annotation Issue [message #1007550 is a reply to message #1007378] Wed, 06 February 2013 06:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Hi Rob,
This seems to be a bug... Can you enter a bugzilla for it with the ecore below or a link to this forum post?

gr. Martin

On 02/05/2013 05:39 PM, Rob Mising name wrote:
> Hi Martin,
>
> I have come across a small problem I would be grateful if you could cast you expert eyes over.
>
> I have an eCore:
>
> <eClassifiers xsi:type="ecore:EClass" name="Case1">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Case1"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Table(name="ROBTEST_CASE1")
> @Entity(name="com.example.robtest.Case1")
> @DiscriminatorValue("com.example.robtest.Case1")"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference" name="case2" upperBound="-1" eType="//Case2"
> eOpposite="//Case2/case1">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="case2"/>
> </eAnnotations>
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@JoinTable(name="ROBTEST_CASE1_CASE2")
> @Column(name="CASE2")
> @ForeignKey(name="CASE1_CASE2")"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Id
> @Column(name="BDS_ID", nullable="false")"/>
> </eAnnotations>
> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Column(name="BDS_VERSION")
> @Version"/>
> </eAnnotations>
> <eAnnotations source="bds">
> <details key="isVersion" value="true"/>
> </eAnnotations>
> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
> </eStructuralFeatures>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Case2">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Case2"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Table(name="ROBTEST_CASE2")
> @Entity(name="com.example.robtest.Case2")
> @DiscriminatorValue("com.example.robtest.Case2")"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference" name="case1" eType="//Case1" eOpposite="//Case1/case2">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="case1"/>
> </eAnnotations>
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Column(name="CASE1")
> @ForeignKey(name="CASE2_CASE1")"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsId">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Id
> @Column(name="BDS_ID", nullable="false")"/>
> </eAnnotations>
> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="bdsVersion">
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Column(name="BDS_VERSION")
> @Version"/>
> </eAnnotations>
> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
> </eStructuralFeatures>
> </eClassifiers>
>
>
> I suppose the key bit is that I have the @Entity annotation set on the Class1 and Class2 EClass
>
> However, when it generates the Hibernate mapping it looks as follows:
>
> <class entity-name="com.example.robtest.Case1" abstract="false" lazy="false"
> discriminator-value="com.example.robtest.Case1" table="`BDS_1_ROBTEST_CASE1`">
> <meta attribute="eclassName">Case1</meta>
> <meta attribute="epackage">http://example.com/robtest</meta>
> <id name="bdsId" type="java.lang.Long">
> <column not-null="true" unique="false" name="`BDS_ID`"/>
> <generator class="com.tibco.bds.core.naming.CaseDataStoreIdGenerator"/>
> </id>
> <discriminator column="`DTYPE`" type="string"/>
> <version name="bdsVersion" type="java.lang.Long">
> <column not-null="false" unique="false" name="`BDS_VERSION`"/>
> </version>
> <list name="case2" table="`BDS_1_ROBTEST_CASE1CASE2`" lazy="true">
> <key foreign-key="FK_1_ROBTEST_CASE21" update="true">
> <column name="`CASE1_BDSID`" not-null="true" unique="false"/>
> </key>
> <list-index column="`CASE1_CASE2_IDX`"/>
> <many-to-many entity-name="robtest.Case2" unique="true" foreign-key="FK_1_ROBTEST_CASE2">
> <column name="`CASE2_BDSID`" not-null="true" unique="false"/>
> </many-to-many>
> </list>
> </class>
> <class entity-name="com.example.robtest.Case2" abstract="false" lazy="false"
> discriminator-value="com.example.robtest.Case2" table="`BDS_1_ROBTEST_CASE2`">
> <meta attribute="eclassName">Case2</meta>
> <meta attribute="epackage">http://example.com/robtest</meta>
> <id name="bdsId" type="java.lang.Long">
> <column not-null="true" unique="false" name="`BDS_ID`"/>
> <generator class="com.tibco.bds.core.naming.CaseDataStoreIdGenerator"/>
> </id>
> <discriminator column="`DTYPE`" type="string"/>
> <version name="bdsVersion" type="java.lang.Long">
> <column not-null="false" unique="false" name="`BDS_VERSION`"/>
> </version>
> <many-to-one name="case1" entity-name="robtest.Case1" lazy="false" foreign-key="FK_1_ROBTEST_CASE1" insert="true"
> update="true" not-null="false">
> <column not-null="false" unique="false" name="`CASE2_CASE1_BDSID`"/>
> </many-to-one>
> </class>
>
> In this case it generates the entity for the classes OK ("com.example.robtest.Case2"), but the references to it are not
> picking up on that entity name, instead using entity-name="robtest.Case2".
>
> Any thoughts or assistance yould be a great help.
>
> Thanks
>
> Rob
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] Entity JPA Annotation Issue [message #1007551 is a reply to message #1007550] Wed, 06 February 2013 07:27 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising name
Messages: 118
Registered: July 2010
Senior Member
Thanks Martin, I have raised the following as requested:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=400088
Re: [Teneo] Entity JPA Annotation Issue [message #1015600 is a reply to message #1007551] Fri, 01 March 2013 05:41 Go to previous message
Rob Mising name is currently offline Rob Mising name
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

Thank you for fixing that, and supplying the patch.

Sorry for not thanking you earlier - I have been away for a couple of weeks.

Thanks, Rob
Previous Topic:[CDO] Adding CDO authentication to offline example
Next Topic:[Teneo] Strange behaviour when switching EntityNameStrategy
Goto Forum:
  


Current Time: Wed Aug 20 20:29:44 EDT 2014

Powered by FUDForum. Page generated in 0.06871 seconds