Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo]Multiple inheritance with multi-valued EReferences in second inherited class fails
[Teneo]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #75420] Wed, 14 March 2007 12:26 Go to next message
Michael Kanaley is currently offline Michael KanaleyFriend
Messages: 89
Registered: July 2009
Member
Multiple inheritance works fine except when the second (or after) inherited
class has a multi-valued EReference.
I have attached a bundle that you can directly import into Eclipse.
I have removed hibernate and other third party JARs to keep the attachment
small so it will not run until you put all the jars in the lib directory. I
can send you the exact versions if necessary.
It will add a launcher called InheritanceTests.

These tests will fail with a "Could not execute JDBC batch update" exception
which I have included at the bottom of this message.

In this model, a model object called SomeResource extends SomeBaseClass and
SomeOtherBaseClass (in that order). SomeOtherBaseClass has a multi-valued
EReference property called "nameValuePairs" which is an EList of
NameValuePair objects. If you reverse the order of inheritance or remove the
nameValuePairs property then the tests will pass fine.

This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
remove the DB if it exists and regenerate it before each test.

If this is determined to be a bug, it would be great if this fix could also
be applied to a Teneo 0.7.5 release as well.

Thanks for all the work you put into this effort - IMO, it really makes EMF
viable.
-mike
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch
update

at
org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)

at
org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)

at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)

at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)

at
org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)

at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)

at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)

at
org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)

at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)

at
test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)

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)

Caused by: java.sql.BatchUpdateException: failed batch

at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)

at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)

at
org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)

at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)

.... 26 more


Re: [Teneo]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #75592 is a reply to message #75420] Wed, 14 March 2007 15:23 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Mike,
Thanks for providing a testcase. I am kind of busy so it will maybe be a few days (friday or so)
before I can take a look at it.

If it is a fixable bug then I'll provide bugfixes for both the 0.7.5 and 0.8.0 release.

gr. Martin

Michael Kanaley wrote:
> Multiple inheritance works fine except when the second (or after) inherited
> class has a multi-valued EReference.
> I have attached a bundle that you can directly import into Eclipse.
> I have removed hibernate and other third party JARs to keep the attachment
> small so it will not run until you put all the jars in the lib directory. I
> can send you the exact versions if necessary.
> It will add a launcher called InheritanceTests.
>
> These tests will fail with a "Could not execute JDBC batch update" exception
> which I have included at the bottom of this message.
>
> In this model, a model object called SomeResource extends SomeBaseClass and
> SomeOtherBaseClass (in that order). SomeOtherBaseClass has a multi-valued
> EReference property called "nameValuePairs" which is an EList of
> NameValuePair objects. If you reverse the order of inheritance or remove the
> nameValuePairs property then the tests will pass fine.
>
> This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
> remove the DB if it exists and regenerate it before each test.
>
> If this is determined to be a bug, it would be great if this fix could also
> be applied to a Teneo 0.7.5 release as well.
>
> Thanks for all the work you put into this effort - IMO, it really makes EMF
> viable.
> -mike
> org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch
> update
>
> at
> org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)
>
> at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)
>
> at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)
>
> at
> org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)
>
> at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)
>
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>
> at
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)
>
> at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)
>
> at
> test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)
>
> 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)
>
> Caused by: java.sql.BatchUpdateException: failed batch
>
> at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
>
> at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
>
> at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)
>
> .... 26 more
>
>


--

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]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #75990 is a reply to message #75420] Sun, 18 March 2007 22:09 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Mike,
I tested it with mysql and the same error occurs. The cause is the following (assuming joined table
inheritance). As a result of the mapping teneo/hibernate will create 4 tables:
namevaluepair
somebaseclass
someotherbaseclass
someresource

someresource has a foreign key to somebaseclass (its parent eclass table).
The namevaluepair table will have a column for the namevalue pair feature of someotherbaseclass.
This joincolumn has the name: someotherbaseclass_namevaluepairs_e_id.
However because someresource also inherits this feature two foreign keys are created on this one
column, one fk to someresource and one to someotherbaseclass. This happens because the mapping of
namevaluepairs in someresource uses the same joincolumn. The two fk's on one column always result in
a fk constraint violation because when a record is created in someresource, the id of someresource
is placed in someotherbaseclass_namevaluepairs_e_id resulting in a fk violation to
someotherbaseclass (as there is no record in that table).
So to solve this the inherited namevaluepairs feature of someresource needs to use a different
joincolumn.

Can you enter a bugzilla for this? Then I can implement a solution in 0.7.5/0.8.0. Bugzillas are
required for creating the release notes.
When the bugzilla is entered I will create a bugfix for this. The bugfix will automatically rename
the jointable/column for inherited efeatures.

gr. Martin

Michael Kanaley wrote:
> Multiple inheritance works fine except when the second (or after) inherited
> class has a multi-valued EReference.
> I have attached a bundle that you can directly import into Eclipse.
> I have removed hibernate and other third party JARs to keep the attachment
> small so it will not run until you put all the jars in the lib directory. I
> can send you the exact versions if necessary.
> It will add a launcher called InheritanceTests.
>
> These tests will fail with a "Could not execute JDBC batch update" exception
> which I have included at the bottom of this message.
>
> In this model, a model object called SomeResource extends SomeBaseClass and
> SomeOtherBaseClass (in that order). SomeOtherBaseClass has a multi-valued
> EReference property called "nameValuePairs" which is an EList of
> NameValuePair objects. If you reverse the order of inheritance or remove the
> nameValuePairs property then the tests will pass fine.
>
> This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
> remove the DB if it exists and regenerate it before each test.
>
> If this is determined to be a bug, it would be great if this fix could also
> be applied to a Teneo 0.7.5 release as well.
>
> Thanks for all the work you put into this effort - IMO, it really makes EMF
> viable.
> -mike
> org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch
> update
>
> at
> org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)
>
> at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)
>
> at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)
>
> at
> org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)
>
> at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)
>
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>
> at
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)
>
> at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)
>
> at
> test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)
>
> 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)
>
> Caused by: java.sql.BatchUpdateException: failed batch
>
> at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
>
> at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
>
> at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)
>
> .... 26 more
>
>


--

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]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #76098 is a reply to message #75990] Wed, 21 March 2007 00:32 Go to previous message
Michael Kanaley is currently offline Michael KanaleyFriend
Messages: 89
Registered: July 2009
Member
Bugzilla number 178471.
Thanks,
-mike

"Martin Taal" <mtaal@elver.org> wrote in message
news:etkdbb$8eu$1@utils.eclipse.org...
> Mike,
> I tested it with mysql and the same error occurs. The cause is the
> following (assuming joined table inheritance). As a result of the mapping
> teneo/hibernate will create 4 tables:
> namevaluepair
> somebaseclass
> someotherbaseclass
> someresource
>
> someresource has a foreign key to somebaseclass (its parent eclass table).
> The namevaluepair table will have a column for the namevalue pair feature
> of someotherbaseclass. This joincolumn has the name:
> someotherbaseclass_namevaluepairs_e_id.
> However because someresource also inherits this feature two foreign keys
> are created on this one column, one fk to someresource and one to
> someotherbaseclass. This happens because the mapping of namevaluepairs in
> someresource uses the same joincolumn. The two fk's on one column always
> result in a fk constraint violation because when a record is created in
> someresource, the id of someresource is placed in
> someotherbaseclass_namevaluepairs_e_id resulting in a fk violation to
> someotherbaseclass (as there is no record in that table).
> So to solve this the inherited namevaluepairs feature of someresource
> needs to use a different joincolumn.
>
> Can you enter a bugzilla for this? Then I can implement a solution in
> 0.7.5/0.8.0. Bugzillas are required for creating the release notes.
> When the bugzilla is entered I will create a bugfix for this. The bugfix
> will automatically rename the jointable/column for inherited efeatures.
>
> gr. Martin
>
> Michael Kanaley wrote:
>> Multiple inheritance works fine except when the second (or after)
>> inherited class has a multi-valued EReference.
>> I have attached a bundle that you can directly import into Eclipse.
>> I have removed hibernate and other third party JARs to keep the
>> attachment small so it will not run until you put all the jars in the lib
>> directory. I can send you the exact versions if necessary.
>> It will add a launcher called InheritanceTests.
>>
>> These tests will fail with a "Could not execute JDBC batch update"
>> exception which I have included at the bottom of this message.
>>
>> In this model, a model object called SomeResource extends SomeBaseClass
>> and SomeOtherBaseClass (in that order). SomeOtherBaseClass has a
>> multi-valued EReference property called "nameValuePairs" which is an
>> EList of NameValuePair objects. If you reverse the order of inheritance
>> or remove the nameValuePairs property then the tests will pass fine.
>>
>> This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
>> remove the DB if it exists and regenerate it before each test.
>>
>> If this is determined to be a bug, it would be great if this fix could
>> also be applied to a Teneo 0.7.5 release as well.
>>
>> Thanks for all the work you put into this effort - IMO, it really makes
>> EMF viable.
>> -mike
>> org.hibernate.exception.GenericJDBCException: Could not execute JDBC
>> batch update
>>
>> at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)
>>
>> at
>> org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)
>>
>> at
>> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
>>
>> at
>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)
>>
>> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)
>>
>> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)
>>
>> at
>> org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)
>>
>> at
>> org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)
>>
>> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)
>>
>> at
>> org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)
>>
>> at
>> test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)
>>
>> 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)
>>
>> Caused by: java.sql.BatchUpdateException: failed batch
>>
>> at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
>>
>> at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
>>
>> at
>> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)
>>
>> at
>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)
>>
>> .... 26 more
>>
>>
>
>
> --
>
> 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]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #603643 is a reply to message #75420] Wed, 14 March 2007 15:23 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Mike,
Thanks for providing a testcase. I am kind of busy so it will maybe be a few days (friday or so)
before I can take a look at it.

If it is a fixable bug then I'll provide bugfixes for both the 0.7.5 and 0.8.0 release.

gr. Martin

Michael Kanaley wrote:
> Multiple inheritance works fine except when the second (or after) inherited
> class has a multi-valued EReference.
> I have attached a bundle that you can directly import into Eclipse.
> I have removed hibernate and other third party JARs to keep the attachment
> small so it will not run until you put all the jars in the lib directory. I
> can send you the exact versions if necessary.
> It will add a launcher called InheritanceTests.
>
> These tests will fail with a "Could not execute JDBC batch update" exception
> which I have included at the bottom of this message.
>
> In this model, a model object called SomeResource extends SomeBaseClass and
> SomeOtherBaseClass (in that order). SomeOtherBaseClass has a multi-valued
> EReference property called "nameValuePairs" which is an EList of
> NameValuePair objects. If you reverse the order of inheritance or remove the
> nameValuePairs property then the tests will pass fine.
>
> This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
> remove the DB if it exists and regenerate it before each test.
>
> If this is determined to be a bug, it would be great if this fix could also
> be applied to a Teneo 0.7.5 release as well.
>
> Thanks for all the work you put into this effort - IMO, it really makes EMF
> viable.
> -mike
> org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch
> update
>
> at
> org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)
>
> at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)
>
> at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)
>
> at
> org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)
>
> at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)
>
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>
> at
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)
>
> at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)
>
> at
> test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)
>
> 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)
>
> Caused by: java.sql.BatchUpdateException: failed batch
>
> at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
>
> at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
>
> at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)
>
> .... 26 more
>
>


--

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]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #603718 is a reply to message #75420] Sun, 18 March 2007 22:09 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Mike,
I tested it with mysql and the same error occurs. The cause is the following (assuming joined table
inheritance). As a result of the mapping teneo/hibernate will create 4 tables:
namevaluepair
somebaseclass
someotherbaseclass
someresource

someresource has a foreign key to somebaseclass (its parent eclass table).
The namevaluepair table will have a column for the namevalue pair feature of someotherbaseclass.
This joincolumn has the name: someotherbaseclass_namevaluepairs_e_id.
However because someresource also inherits this feature two foreign keys are created on this one
column, one fk to someresource and one to someotherbaseclass. This happens because the mapping of
namevaluepairs in someresource uses the same joincolumn. The two fk's on one column always result in
a fk constraint violation because when a record is created in someresource, the id of someresource
is placed in someotherbaseclass_namevaluepairs_e_id resulting in a fk violation to
someotherbaseclass (as there is no record in that table).
So to solve this the inherited namevaluepairs feature of someresource needs to use a different
joincolumn.

Can you enter a bugzilla for this? Then I can implement a solution in 0.7.5/0.8.0. Bugzillas are
required for creating the release notes.
When the bugzilla is entered I will create a bugfix for this. The bugfix will automatically rename
the jointable/column for inherited efeatures.

gr. Martin

Michael Kanaley wrote:
> Multiple inheritance works fine except when the second (or after) inherited
> class has a multi-valued EReference.
> I have attached a bundle that you can directly import into Eclipse.
> I have removed hibernate and other third party JARs to keep the attachment
> small so it will not run until you put all the jars in the lib directory. I
> can send you the exact versions if necessary.
> It will add a launcher called InheritanceTests.
>
> These tests will fail with a "Could not execute JDBC batch update" exception
> which I have included at the bottom of this message.
>
> In this model, a model object called SomeResource extends SomeBaseClass and
> SomeOtherBaseClass (in that order). SomeOtherBaseClass has a multi-valued
> EReference property called "nameValuePairs" which is an EList of
> NameValuePair objects. If you reverse the order of inheritance or remove the
> nameValuePairs property then the tests will pass fine.
>
> This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
> remove the DB if it exists and regenerate it before each test.
>
> If this is determined to be a bug, it would be great if this fix could also
> be applied to a Teneo 0.7.5 release as well.
>
> Thanks for all the work you put into this effort - IMO, it really makes EMF
> viable.
> -mike
> org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch
> update
>
> at
> org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)
>
> at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)
>
> at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)
>
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)
>
> at
> org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)
>
> at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)
>
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>
> at
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)
>
> at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)
>
> at
> test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)
>
> 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)
>
> Caused by: java.sql.BatchUpdateException: failed batch
>
> at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
>
> at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
>
> at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)
>
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)
>
> .... 26 more
>
>


--

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]Multiple inheritance with multi-valued EReferences in second inherited class fails [message #603748 is a reply to message #75990] Wed, 21 March 2007 00:32 Go to previous message
Michael Kanaley is currently offline Michael KanaleyFriend
Messages: 89
Registered: July 2009
Member
Bugzilla number 178471.
Thanks,
-mike

"Martin Taal" <mtaal@elver.org> wrote in message
news:etkdbb$8eu$1@utils.eclipse.org...
> Mike,
> I tested it with mysql and the same error occurs. The cause is the
> following (assuming joined table inheritance). As a result of the mapping
> teneo/hibernate will create 4 tables:
> namevaluepair
> somebaseclass
> someotherbaseclass
> someresource
>
> someresource has a foreign key to somebaseclass (its parent eclass table).
> The namevaluepair table will have a column for the namevalue pair feature
> of someotherbaseclass. This joincolumn has the name:
> someotherbaseclass_namevaluepairs_e_id.
> However because someresource also inherits this feature two foreign keys
> are created on this one column, one fk to someresource and one to
> someotherbaseclass. This happens because the mapping of namevaluepairs in
> someresource uses the same joincolumn. The two fk's on one column always
> result in a fk constraint violation because when a record is created in
> someresource, the id of someresource is placed in
> someotherbaseclass_namevaluepairs_e_id resulting in a fk violation to
> someotherbaseclass (as there is no record in that table).
> So to solve this the inherited namevaluepairs feature of someresource
> needs to use a different joincolumn.
>
> Can you enter a bugzilla for this? Then I can implement a solution in
> 0.7.5/0.8.0. Bugzillas are required for creating the release notes.
> When the bugzilla is entered I will create a bugfix for this. The bugfix
> will automatically rename the jointable/column for inherited efeatures.
>
> gr. Martin
>
> Michael Kanaley wrote:
>> Multiple inheritance works fine except when the second (or after)
>> inherited class has a multi-valued EReference.
>> I have attached a bundle that you can directly import into Eclipse.
>> I have removed hibernate and other third party JARs to keep the
>> attachment small so it will not run until you put all the jars in the lib
>> directory. I can send you the exact versions if necessary.
>> It will add a launcher called InheritanceTests.
>>
>> These tests will fail with a "Could not execute JDBC batch update"
>> exception which I have included at the bottom of this message.
>>
>> In this model, a model object called SomeResource extends SomeBaseClass
>> and SomeOtherBaseClass (in that order). SomeOtherBaseClass has a
>> multi-valued EReference property called "nameValuePairs" which is an
>> EList of NameValuePair objects. If you reverse the order of inheritance
>> or remove the nameValuePairs property then the tests will pass fine.
>>
>> This test uses Teneo 0.8.0 with HSQLDB. The test suites will dynamically
>> remove the DB if it exists and regenerate it before each test.
>>
>> If this is determined to be a bug, it would be great if this fix could
>> also be applied to a Teneo 0.7.5 release as well.
>>
>> Thanks for all the work you put into this effort - IMO, it really makes
>> EMF viable.
>> -mike
>> org.hibernate.exception.GenericJDBCException: Could not execute JDBC
>> batch update
>>
>> at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecific Exception(SQLStateConverter.java:103)
>>
>> at
>> org.hibernate.exception.SQLStateConverter.convert(SQLStateCo nverter.java:91)
>>
>> at
>> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExce ptionHelper.java:43)
>>
>> at
>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:249)
>>
>> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:235)
>>
>> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:143)
>>
>> at
>> org.hibernate.event.def.AbstractFlushingEventListener.perfor mExecutions(AbstractFlushingEventListener.java:298)
>>
>> at
>> org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:27)
>>
>> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:244)
>>
>> at
>> org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:365)
>>
>> at
>> test.teneo.inheritance.InheritanceTests.testSavingAuthorizab les(InheritanceTests.java:96)
>>
>> 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)
>>
>> Caused by: java.sql.BatchUpdateException: failed batch
>>
>> at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
>>
>> at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
>>
>> at
>> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBa tcher.java:48)
>>
>> at
>> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatc her.java:242)
>>
>> .... 26 more
>>
>>
>
>
> --
>
> 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:Duplicate properties appearing in subclass.
Next Topic:New to JET can't access xsi:type value
Goto Forum:
  


Current Time: Sun Dec 21 13:00:44 GMT 2014

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

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