Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo]Feature request to support the @Entity annotation
[Teneo]Feature request to support the @Entity annotation [message #81813] Thu, 03 May 2007 21:14 Go to next message
Michael Kanaley is currently offline Michael KanaleyFriend
Messages: 89
Registered: July 2009
Member
Below is an exception encountered when I add the following annotation to an
EClass.
@Entity(name="SomeOtherNameForClass")

Perhaps Teneo could provide a EClassNameStrategy that supports this
annotation?
Is there a way to get the annotations given an EClass? - it might be easy to
augment the default EClassNameStrategy.

Using the QUALIFY_ENTITY_NAME=nsprefix is not ideal since it applies to all
models. If an application has already shipped a version and a new model is
added that tries to reuse a name then backward compatibility is broken when
this flag is set.

Attached is a test suite.
Thanks for considering this.
-mike

java.lang.IllegalArgumentException: No EClass found using
SomeOtherNameForClass
at
org.eclipse.emf.teneo.ecore.DefaultEClassNameStrategy.toECla ss(DefaultEClassNameStrategy.java:78)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.setRefersToOfSup ers(HbDataStore.java:815)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.computeReferers( HbDataStore.java:803)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:163)
at test.teneo.EntitynameTests.createHbDataStore(EntitynameTests .java:71)
at test.teneo.EntitynameTests.testSaving(EntitynameTests.java:8 5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)



Re: [Teneo]Feature request to support the @Entity annotation [message #81830 is a reply to message #81813] Fri, 04 May 2007 05:03 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The entity annotation is supported to tag a eclass as persistable (and all non-entitied eclasses as
non-persistable). However as you say the name attribute is not picked up by the default eclass name
strategy. This is a missing feature/bug.

Can you enter a bugzilla for this and attach your testcase to it?

In the 0.8.0 release there is a getPaModel method on the datastore you can call to get to the
annotated model. In the 0.7.5. release this method is not yet there (I just added it in cvs).
the following call will create a pamodel for you also (see the mapEPackages method in the HbDataStore):
MappingBuilder.INSTANCE.buildMapping(getEPackages(), persistenceoptions)

You can ask a pamodel for an annotated eclass by calling: paModel.getPAnnotated(eclass)
the annotated eclass wraps the eclass and has getters and setters for the jpa annotations.

Currently the eclassnamestrategy instance is created by the persistenceoptions itself without access
to the pamodel (or the datastore), this probably needs to be reworked for this.

gr. Martin

Michael Kanaley wrote:
> Below is an exception encountered when I add the following annotation to an
> EClass.
> @Entity(name="SomeOtherNameForClass")
>
> Perhaps Teneo could provide a EClassNameStrategy that supports this
> annotation?
> Is there a way to get the annotations given an EClass? - it might be easy to
> augment the default EClassNameStrategy.
>
> Using the QUALIFY_ENTITY_NAME=nsprefix is not ideal since it applies to all
> models. If an application has already shipped a version and a new model is
> added that tries to reuse a name then backward compatibility is broken when
> this flag is set.
>
> Attached is a test suite.
> Thanks for considering this.
> -mike
>
> java.lang.IllegalArgumentException: No EClass found using
> SomeOtherNameForClass
> at
> org.eclipse.emf.teneo.ecore.DefaultEClassNameStrategy.toECla ss(DefaultEClassNameStrategy.java:78)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.setRefersToOfSup ers(HbDataStore.java:815)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.computeReferers( HbDataStore.java:803)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:163)
> at test.teneo.EntitynameTests.createHbDataStore(EntitynameTests .java:71)
> at test.teneo.EntitynameTests.testSaving(EntitynameTests.java:8 5)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
>
>
>


--

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]Feature request to support the @Entity annotation [message #81935 is a reply to message #81830] Fri, 04 May 2007 15:51 Go to previous message
Michael Kanaley is currently offline Michael KanaleyFriend
Messages: 89
Registered: July 2009
Member
Added bugzilla 185574.
Thanks,
-mike

"Martin Taal" <mtaal@elver.org> wrote in message
news:f1eer2$sv1$1@build.eclipse.org...
> The entity annotation is supported to tag a eclass as persistable (and all
> non-entitied eclasses as non-persistable). However as you say the name
> attribute is not picked up by the default eclass name strategy. This is a
> missing feature/bug.
>
> Can you enter a bugzilla for this and attach your testcase to it?
>
> In the 0.8.0 release there is a getPaModel method on the datastore you can
> call to get to the annotated model. In the 0.7.5. release this method is
> not yet there (I just added it in cvs).
> the following call will create a pamodel for you also (see the
> mapEPackages method in the HbDataStore):
> MappingBuilder.INSTANCE.buildMapping(getEPackages(), persistenceoptions)
>
> You can ask a pamodel for an annotated eclass by calling:
> paModel.getPAnnotated(eclass)
> the annotated eclass wraps the eclass and has getters and setters for the
> jpa annotations.
>
> Currently the eclassnamestrategy instance is created by the
> persistenceoptions itself without access to the pamodel (or the
> datastore), this probably needs to be reworked for this.
>
> gr. Martin
>
> Michael Kanaley wrote:
>> Below is an exception encountered when I add the following annotation to
>> an EClass.
>> @Entity(name="SomeOtherNameForClass")
>>
>> Perhaps Teneo could provide a EClassNameStrategy that supports this
>> annotation?
>> Is there a way to get the annotations given an EClass? - it might be easy
>> to augment the default EClassNameStrategy.
>>
>> Using the QUALIFY_ENTITY_NAME=nsprefix is not ideal since it applies to
>> all models. If an application has already shipped a version and a new
>> model is added that tries to reuse a name then backward compatibility is
>> broken when this flag is set.
>>
>> Attached is a test suite.
>> Thanks for considering this.
>> -mike
>>
>> java.lang.IllegalArgumentException: No EClass found using
>> SomeOtherNameForClass
>> at
>> org.eclipse.emf.teneo.ecore.DefaultEClassNameStrategy.toECla ss(DefaultEClassNameStrategy.java:78)
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.setRefersToOfSup ers(HbDataStore.java:815)
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.computeReferers( HbDataStore.java:803)
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:163)
>> at test.teneo.EntitynameTests.createHbDataStore(EntitynameTests .java:71)
>> at test.teneo.EntitynameTests.testSaving(EntitynameTests.java:8 5)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at junit.framework.TestCase.runTest(TestCase.java:154)
>> at junit.framework.TestCase.runBare(TestCase.java:127)
>> at junit.framework.TestResult$1.protect(TestResult.java:106)
>> at junit.framework.TestResult.runProtected(TestResult.java:124)
>> at junit.framework.TestResult.run(TestResult.java:109)
>> at junit.framework.TestCase.run(TestCase.java:118)
>> at junit.framework.TestSuite.runTest(TestSuite.java:208)
>> at junit.framework.TestSuite.run(TestSuite.java:203)
>> at
>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
>> at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
>>
>>
>>
>
>
> --
>
> 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]Feature request to support the @Entity annotation [message #605217 is a reply to message #81813] Fri, 04 May 2007 05:03 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The entity annotation is supported to tag a eclass as persistable (and all non-entitied eclasses as
non-persistable). However as you say the name attribute is not picked up by the default eclass name
strategy. This is a missing feature/bug.

Can you enter a bugzilla for this and attach your testcase to it?

In the 0.8.0 release there is a getPaModel method on the datastore you can call to get to the
annotated model. In the 0.7.5. release this method is not yet there (I just added it in cvs).
the following call will create a pamodel for you also (see the mapEPackages method in the HbDataStore):
MappingBuilder.INSTANCE.buildMapping(getEPackages(), persistenceoptions)

You can ask a pamodel for an annotated eclass by calling: paModel.getPAnnotated(eclass)
the annotated eclass wraps the eclass and has getters and setters for the jpa annotations.

Currently the eclassnamestrategy instance is created by the persistenceoptions itself without access
to the pamodel (or the datastore), this probably needs to be reworked for this.

gr. Martin

Michael Kanaley wrote:
> Below is an exception encountered when I add the following annotation to an
> EClass.
> @Entity(name="SomeOtherNameForClass")
>
> Perhaps Teneo could provide a EClassNameStrategy that supports this
> annotation?
> Is there a way to get the annotations given an EClass? - it might be easy to
> augment the default EClassNameStrategy.
>
> Using the QUALIFY_ENTITY_NAME=nsprefix is not ideal since it applies to all
> models. If an application has already shipped a version and a new model is
> added that tries to reuse a name then backward compatibility is broken when
> this flag is set.
>
> Attached is a test suite.
> Thanks for considering this.
> -mike
>
> java.lang.IllegalArgumentException: No EClass found using
> SomeOtherNameForClass
> at
> org.eclipse.emf.teneo.ecore.DefaultEClassNameStrategy.toECla ss(DefaultEClassNameStrategy.java:78)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.setRefersToOfSup ers(HbDataStore.java:815)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.computeReferers( HbDataStore.java:803)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:163)
> at test.teneo.EntitynameTests.createHbDataStore(EntitynameTests .java:71)
> at test.teneo.EntitynameTests.testSaving(EntitynameTests.java:8 5)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
>
>
>


--

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]Feature request to support the @Entity annotation [message #605241 is a reply to message #81830] Fri, 04 May 2007 15:51 Go to previous message
Michael Kanaley is currently offline Michael KanaleyFriend
Messages: 89
Registered: July 2009
Member
Added bugzilla 185574.
Thanks,
-mike

"Martin Taal" <mtaal@elver.org> wrote in message
news:f1eer2$sv1$1@build.eclipse.org...
> The entity annotation is supported to tag a eclass as persistable (and all
> non-entitied eclasses as non-persistable). However as you say the name
> attribute is not picked up by the default eclass name strategy. This is a
> missing feature/bug.
>
> Can you enter a bugzilla for this and attach your testcase to it?
>
> In the 0.8.0 release there is a getPaModel method on the datastore you can
> call to get to the annotated model. In the 0.7.5. release this method is
> not yet there (I just added it in cvs).
> the following call will create a pamodel for you also (see the
> mapEPackages method in the HbDataStore):
> MappingBuilder.INSTANCE.buildMapping(getEPackages(), persistenceoptions)
>
> You can ask a pamodel for an annotated eclass by calling:
> paModel.getPAnnotated(eclass)
> the annotated eclass wraps the eclass and has getters and setters for the
> jpa annotations.
>
> Currently the eclassnamestrategy instance is created by the
> persistenceoptions itself without access to the pamodel (or the
> datastore), this probably needs to be reworked for this.
>
> gr. Martin
>
> Michael Kanaley wrote:
>> Below is an exception encountered when I add the following annotation to
>> an EClass.
>> @Entity(name="SomeOtherNameForClass")
>>
>> Perhaps Teneo could provide a EClassNameStrategy that supports this
>> annotation?
>> Is there a way to get the annotations given an EClass? - it might be easy
>> to augment the default EClassNameStrategy.
>>
>> Using the QUALIFY_ENTITY_NAME=nsprefix is not ideal since it applies to
>> all models. If an application has already shipped a version and a new
>> model is added that tries to reuse a name then backward compatibility is
>> broken when this flag is set.
>>
>> Attached is a test suite.
>> Thanks for considering this.
>> -mike
>>
>> java.lang.IllegalArgumentException: No EClass found using
>> SomeOtherNameForClass
>> at
>> org.eclipse.emf.teneo.ecore.DefaultEClassNameStrategy.toECla ss(DefaultEClassNameStrategy.java:78)
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.setRefersToOfSup ers(HbDataStore.java:815)
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.computeReferers( HbDataStore.java:803)
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:163)
>> at test.teneo.EntitynameTests.createHbDataStore(EntitynameTests .java:71)
>> at test.teneo.EntitynameTests.testSaving(EntitynameTests.java:8 5)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at junit.framework.TestCase.runTest(TestCase.java:154)
>> at junit.framework.TestCase.runBare(TestCase.java:127)
>> at junit.framework.TestResult$1.protect(TestResult.java:106)
>> at junit.framework.TestResult.runProtected(TestResult.java:124)
>> at junit.framework.TestResult.run(TestResult.java:109)
>> at junit.framework.TestCase.run(TestCase.java:118)
>> at junit.framework.TestSuite.runTest(TestSuite.java:208)
>> at junit.framework.TestSuite.run(TestSuite.java:203)
>> at
>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)
>> at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
>>
>>
>>
>
>
> --
>
> 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] MappingBuilder customization
Next Topic:[Teneo] PersistenceMappingBuilder error
Goto Forum:
  


Current Time: Tue Apr 16 04:37:32 GMT 2024

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

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

Back to the top