Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] EntityInterfaceNameStrategy not setting Enumerations as expected(Enumerations set as if using QualifyingEntityNameStrategy)
[Teneo] EntityInterfaceNameStrategy not setting Enumerations as expected [message #1007549] Wed, 06 February 2013 11:54 Go to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

I noticed in the FAQ, that there is an additional Entity Naming Strategy called "EntityInterfaceNameStrategy":

http://wiki.eclipse.org/Teneo/Hibernate/FAQ#Unknown_Entity

I was surprised it was not listed in the Docs:

http://wiki.eclipse.org/Teneo/Hibernate/Extensions#EntityNameStrategy_ExtensionPoint_.28org.eclipse.emf.teneo.mapping.strategy.EntityNameStrategy.29

This seemed to be in line with the sort of entity naming strategy that I was looking for, however it does not seem to cover the case of the Enumerations, so if I have an eCore as follows:

  <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;ENUMTEST_CASE1&quot;)&#xA;@DiscriminatorValue(&quot;com.example.enumtest.Case1&quot;)"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="attribute1" eType="//Enumeration1Object">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
        <details key="kind" value="element"/>
        <details key="name" value="attribute1"/>
      </eAnnotations>
      <eAnnotations source="teneo.jpa">
        <details key="value" value="@Column(name=&quot;ATTRIBUTE1&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>
  <eClassifiers xsi:type="ecore:EEnum" name="Enumeration1">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Enumeration1"/>
    </eAnnotations>
    <eLiterals name="ENUMLIT1"/>
    <eLiterals name="ENUMLIT2" value="1"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EDataType" name="Enumeration1ElementType" instanceClassName="org.eclipse.emf.common.util.Enumerator">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Enumeration1Element_._type"/>
      <details key="baseType" value="Enumeration1"/>
    </eAnnotations>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EDataType" name="Enumeration1Object" instanceClassName="org.eclipse.emf.common.util.Enumerator">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="Enumeration1:Object"/>
      <details key="baseType" value="Enumeration1"/>
    </eAnnotations>
  </eClassifiers>


Then it will generate a Hibernate mapping as follows:

<hibernate-mapping auto-import="false">
	<typedef name="enumtest.Enumeration1ElementType" class="org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserType">
		<param name="epackage">http://example.com/enumtest</param>
		<param name="edatatype">Enumeration1ElementType</param>
	</typedef>
	<typedef name="enumtest.Enumeration1Object" class="org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserType">
		<param name="epackage">http://example.com/enumtest</param>
		<param name="edatatype">Enumeration1Object</param>
	</typedef>
	<class name="com.example.enumtest.impl.Case1Impl" entity-name="com.example.enumtest.Case1" abstract="false" lazy="false" discriminator-value="com.example.enumtest.Case1" table="`BDS_1_ENUMTEST_CASE1`">
		<meta attribute="eclassName">Case1</meta>
		<meta attribute="epackage">http://example.com/enumtest</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>
		<property name="attribute1" lazy="false" insert="true" update="true" not-null="false" unique="false" type="enumtest.Enumeration1Object">
			<column not-null="false" unique="false" name="`ATTRIBUTE1`"/>
		</property>
	</class>
</hibernate-mapping>


It appears to set the Case1 entity-name [and name] as expected (com.example.enumtest.Case1), however the enumerations just get name="enumtest.Enumeration1ElementType" - where I was assuming it would be fully qualified as well?

Was this the intended behaviour - I wasn't sure if I was missing something.

Thanks

Rob

[Updated on: Wed, 06 February 2013 12:28]

Report message to a moderator

Re: [Teneo] EntityInterfaceNameStrategy no setting Enumerations correctly [message #1007734 is a reply to message #1007549] Thu, 07 February 2013 11:01 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Rob,
Hmm, yes in this case, the enum is not an entity but an internal hbm-type definition. So it is something used within the
hbm-mapping and not something normally used outside of it (like in a hql query). Is it a showstopper or just something
you noticed?

gr. Martin

On 02/06/2013 12:54 PM, Rob Mising name wrote:
> Hi Martin,
>
> I noticed in the FAQ, that there is an additional Entity Naming Strategy called "EntityInterfaceNameStrategy":
>
> http://wiki.eclipse.org/Teneo/Hibernate/FAQ#Unknown_Entity
>
> I was surprised it was not listed in the Docs:
>
> http://wiki.eclipse.org/Teneo/Hibernate/Extensions#EntityNameStrategy_ExtensionPoint_.28org.eclipse.emf.teneo.mapping.strategy.EntityNameStrategy.29
>
>
> This seemed to be in line with the sort of entity naming strategy that I was looking for, however it does not seem to
> cover the case of the Enumerations, so if I have an eCore as follows:
>
> <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="ENUMTEST_CASE1")
> @DiscriminatorValue("com.example.enumtest.Case1")"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="attribute1" eType="//Enumeration1Object">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="attribute1"/>
> </eAnnotations>
> <eAnnotations source="teneo.jpa">
> <details key="value" value="@Column(name="ATTRIBUTE1")"/>
> </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>
> <eClassifiers xsi:type="ecore:EEnum" name="Enumeration1">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Enumeration1"/>
> </eAnnotations>
> <eLiterals name="ENUMLIT1"/>
> <eLiterals name="ENUMLIT2" value="1"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EDataType" name="Enumeration1ElementType"
> instanceClassName="org.eclipse.emf.common.util.Enumerator">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Enumeration1Element_._type"/>
> <details key="baseType" value="Enumeration1"/>
> </eAnnotations>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EDataType" name="Enumeration1Object"
> instanceClassName="org.eclipse.emf.common.util.Enumerator">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Enumeration1:Object"/>
> <details key="baseType" value="Enumeration1"/>
> </eAnnotations>
> </eClassifiers>
>
> Then it will generate a Hibernate mapping as follows:
>
> <hibernate-mapping auto-import="false">
> <typedef name="enumtest.Enumeration1ElementType"
> class="org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserType">
> <param name="epackage">http://example.com/enumtest</param>
> <param name="edatatype">Enumeration1ElementType</param>
> </typedef>
> <typedef name="enumtest.Enumeration1Object" class="org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserType">
> <param name="epackage">http://example.com/enumtest</param>
> <param name="edatatype">Enumeration1Object</param>
> </typedef>
> <class name="com.example.enumtest.impl.Case1Impl" entity-name="com.example.enumtest.Case1" abstract="false"
> lazy="false" discriminator-value="com.example.enumtest.Case1" table="`BDS_1_ENUMTEST_CASE1`">
> <meta attribute="eclassName">Case1</meta>
> <meta attribute="epackage">http://example.com/enumtest</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>
> <property name="attribute1" lazy="false" insert="true" update="true" not-null="false" unique="false"
> type="enumtest.Enumeration1Object">
> <column not-null="false" unique="false" name="`ATTRIBUTE1`"/>
> </property>
> </class>
> </hibernate-mapping>
>
> It appears to set the Case1 entity-name [and name] as expected (com.example.enumtest.Case1), however the enumerations
> just get name="enumtest.Enumeration1ElementType" - where I was assuming it would be fully qualified as well?
>
> Was this the intended behaviour - I wasn't sure if I was missing something.
>
> 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] EntityInterfaceNameStrategy no setting Enumerations correctly [message #1007737 is a reply to message #1007734] Thu, 07 February 2013 11:08 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Martin,

It's just something I noticed - I don't think it's causing me a problem, it was just something else I was trying when I was blocked by:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=400088

Hope this is OK.

Thanks

Rob
Re: [Teneo] EntityInterfaceNameStrategy no setting Enumerations correctly [message #1007804 is a reply to message #1007737] Thu, 07 February 2013 14:42 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Rob,
No problem at all, you can post/ask anything

gr. Martin

On 02/07/2013 12:08 PM, Rob Mising name wrote:
> Hi Martin,
>
> It's just something I noticed - I don't think it's causing me a problem, it was just something else I was trying when I
> was blocked by:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=400088
>
> Hope this is OK.
>
> 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
Previous Topic:[CDO] importer Exception
Next Topic:[CDO] Offline clone doesn't reload offline branche
Goto Forum:
  


Current Time: Fri Apr 19 18:58:16 GMT 2024

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

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

Back to the top