Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Transaction Exception(Transaction Exception due to "id instanceof CDOIDTemp")
[CDO] Transaction Exception [message #513552] Wed, 10 February 2010 14:47 Go to next message
Sabri Skhiri is currently offline Sabri SkhiriFriend
Messages: 43
Registered: February 2010
Member
All,

I am playing with the material given by Eike at Eclipse summit during the Advanced Programming Techniques with EMF and CDO.
I have a problem when creating a simple Root Eobject within a transaction:
CDOSession session = openSession();
session.getPackageRegistry().putEPackage(InventoryPackage.eI NSTANCE);
// open the transaction
CDOTransaction transaction = session.openTransaction();

// create the resource
CDOResource resource = transaction.getResource("/edine/resto2.inventory");
// Work with resource
Restaurant restaurant = InventoryFactory.eINSTANCE.createRestaurant();
resource.getContents().add(restaurant);

// Commit the transaction
transaction.commit();

session.close();

But I have got a TransactionException due to the "id instanceof CDOIDTemp".
Have you got any idea ?



The exception is:
Exception in thread "main" org.eclipse.net4j.util.transaction.TransactionException: Rollback in DBStore: java.lang.IllegalArgumentException: id instanceof CDOIDTemp
at org.eclipse.emf.cdo.common.id.CDOIDUtil.getLong(CDOIDUtil.ja va:87)
at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.getMe taID(MetaDataManager.java:72)
at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi ngStrategy.getTableName(AbstractMappingStrategy.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.initTable(AbstractHorizontalCla ssMapping.java:82)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping. <init>(AbstractHorizontalClassMapping.java:76)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ho rizontalAuditClassMapping. <init>(HorizontalAuditClassMapping.java:64)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ho rizontalAuditMappingStrategy.doCreateClassMapping(Horizontal AuditMappingStrategy.java:29)
at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi ngStrategy.createClassMapping(AbstractMappingStrategy.java:3 84)
at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi ngStrategy.getClassMapping(AbstractMappingStrategy.java:411)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:359)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:342)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:145)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:299)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:273)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication$1.runLoop(CommitTransactionIndication.jav a:72)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication$1.runLoop(CommitTransactionIndication.jav a:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicatingCommit(CommitTransactionIndicat ion.java:280)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:173)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:139)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)

at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactio nStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:6 3)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl. commit(CDOTransactionImpl.java:621)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl. commit(CDOTransactionImpl.java:635)
at org.gastro.exercises.Exercice11b.main(Exercice11b.java:90)
Re: [CDO] Transaction Exception [message #513610 is a reply to message #513552] Wed, 10 February 2010 11:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 10.02.2010 15:47, schrieb Sabri Skhiri:
> All,
>
> I am playing with the material given by Eike at Eclipse summit during
> the Advanced Programming Techniques with EMF and CDO.
> I have a problem when creating a simple Root Eobject within a
> transaction:
> CDOSession session = openSession();
> session.getPackageRegistry().putEPackage(InventoryPackage.eI NSTANCE);
putEPackage() shouldn't be necessary.

> // open the transaction
> CDOTransaction transaction = session.openTransaction();
>
> // create the resource
> CDOResource resource =
> transaction.getResource("/edine/resto2.inventory");
Shouldn't that be createResource()?

> // Work with resource
> Restaurant restaurant = InventoryFactory.eINSTANCE.createRestaurant();
> resource.getContents().add(restaurant);
>
> // Commit the transaction
> transaction.commit();
>
> session.close();
>
> But I have got a TransactionException due to the "id instanceof
> CDOIDTemp".
> Have you got any idea ?
>
>
>
> The exception is:
I admit that te exception message is not very convenient :P

Which exact version of CDO are you using?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> Exception in thread "main"
> org.eclipse.net4j.util.transaction.TransactionException: Rollback in
> DBStore: java.lang.IllegalArgumentException: id instanceof CDOIDTemp
> at org.eclipse.emf.cdo.common.id.CDOIDUtil.getLong(CDOIDUtil.ja va:87)
> at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.getMe
> taID(MetaDataManager.java:72)
> at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi
> ngStrategy.getTableName(AbstractMappingStrategy.java:256)
> at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab
> stractHorizontalClassMapping.initTable(AbstractHorizontalCla
> ssMapping.java:82)
> at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab
> stractHorizontalClassMapping.
> <init>(AbstractHorizontalClassMapping.java:76)
> at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ho
> rizontalAuditClassMapping. <init>(HorizontalAuditClassMapping.java:64)
> at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ho
> rizontalAuditMappingStrategy.doCreateClassMapping(Horizontal
> AuditMappingStrategy.java:29)
> at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi
> ngStrategy.createClassMapping(AbstractMappingStrategy.java:3 84)
> at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi
> ngStrategy.getClassMapping(AbstractMappingStrategy.java:411)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write
> Revision(DBStoreAccessor.java:359)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write
> Revisions(DBStoreAccessor.java:342)
> at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce
> ssor.java:145)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces
> s$4(DBStoreAccessor.java:1)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run
> Loop(DBStoreAccessor.java:80)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run
> Loop(DBStoreAccessor.java:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr
> ogressDistributor.java:96)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write
> (DBStoreAccessor.java:299)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext
> Impl.write(TransactionCommitContextImpl.java:273)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra
> nsactionIndication$1.runLoop(CommitTransactionIndication.jav a:72)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra
> nsactionIndication$1.runLoop(CommitTransactionIndication.jav a:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr
> ogressDistributor.java:96)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra
> nsactionIndication.indicatingCommit(CommitTransactionIndicat
> ion.java:280)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra
> nsactionIndication.indicating(CommitTransactionIndication.ja va:173)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra
> nsactionIndication.indicating(CommitTransactionIndication.ja va:139)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating
> (IndicationWithMonitoring.java:84)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn
> put(IndicationWithResponse.java:90)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi
> cationWithResponse.java:63)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In
> dicationWithMonitoring.java:63)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa
> dPoolExecutor.java:650)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
> lExecutor.java:675)
> at java.lang.Thread.run(Thread.java:595)
>
> at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactio
> nStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:6 3)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.
> commit(CDOTransactionImpl.java:621)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.
> commit(CDOTransactionImpl.java:635)
> at org.gastro.exercises.Exercice11b.main(Exercice11b.java:90)


Re: [CDO] Transaction Exception [message #513624 is a reply to message #513610] Wed, 10 February 2010 17:30 Go to previous messageGo to next message
Sabri Skhiri is currently offline Sabri SkhiriFriend
Messages: 43
Registered: February 2010
Member
Hi Eike,
In the plug-in detail I found:
Plug-in version 3.0.0.v2009XX. for all CDO plug-ins. The same for CDO features all pre-fixed by 3.0.0.
Actually I re-use the Eclipse version I got from the Eclipse Summit workshop.
Do you need more information ?

Thanx !

Sabri.
Re: [CDO] Transaction Exception [message #513756 is a reply to message #513624] Thu, 11 February 2010 06:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Have you followed my advice to use createResource() instead of
getResource()?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 10.02.2010 18:30, schrieb Sabri Skhiri:
> Hi Eike,
> In the plug-in detail I found:
> Plug-in version 3.0.0.v2009XX. for all CDO plug-ins. The same for CDO
> features all pre-fixed by 3.0.0.
> Actually I re-use the Eclipse version I got from the Eclipse Summit
> workshop.
> Do you need more information ?
>
> Thanx !
>
> Sabri.


Re: [CDO] Transaction Exception [message #513794 is a reply to message #513756] Thu, 11 February 2010 10:52 Go to previous messageGo to next message
Sabri Skhiri is currently offline Sabri SkhiriFriend
Messages: 43
Registered: February 2010
Member
Actually I tried with a createResource(), with the getorCreateResource() and I have even tried with creating a resource with the CDO client UI. But even with the last try, I managed to create the resource with the client UI, and From my client code, I manage to get it but always the same exception on commit.

BTW, for a production or prototype do you advise to use CDO 3.0 or 2.0 ?

Sabri.
Re: [CDO] Transaction Exception [message #513797 is a reply to message #513794] Thu, 11 February 2010 10:58 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 11.02.2010 11:52, schrieb Sabri Skhiri:
> Actually I tried with a createResource(), with the
> getorCreateResource() and I have even tried with creating a resource
> with the CDO client UI. But even with the last try, I managed to
> create the resource with the client UI, and From my client code, I
> manage to get it but always the same exception on commit.
>
> BTW, for a production or prototype do you advise to use CDO 3.0 or 2.0 ?
For production 2.0 latest (builds to be provided soon again)
For prototyping 3.0 latest.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Transaction Exception [message #513915 is a reply to message #513797] Thu, 11 February 2010 16:23 Go to previous messageGo to next message
Sabri Skhiri is currently offline Sabri SkhiriFriend
Messages: 43
Registered: February 2010
Member
Eike,

I have tried by creating a transaction with the CDO UI Client. The creation of an empty resource works, but if I try to create something within this resource it fails when I commit with this same strange exception. The same if I try from a client Transaction API.

Therefore, I downloaded all the CDO 3.0 sources from repository and I re-test the same use case, it fails with the same exception.

Have you got any idea ?

Thank you,

Sabri.
Re: [CDO] Transaction Exception [message #513951 is a reply to message #513915] Thu, 11 February 2010 13:54 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 11.02.2010 17:23, schrieb Sabri Skhiri:
> Eike,
> I have tried by creating a transaction with the CDO UI Client. The
> creation of an empty resource works, but if I try to create something
> within this resource it fails when I commit with this same strange
> exception. The same if I try from a client Transaction API.
>
> Therefore, I downloaded all the CDO 3.0 sources from repository and I
> re-test the same use case, it fails with the same exception.
> Have you got any idea ?
Can you send me a zip with a test case or a Java program that I can use
to reproduce the problem?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Transaction Exception [message #514036 is a reply to message #513915] Fri, 12 February 2010 09:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Sabri,

I've played with the zips you sent. There's one obvious bug in your
model plugin.xml. The referenced package class does not exist because
you added a package base prefix. Fixing that should enable you to import
the XML file. But you're right, there seems to be a regression in the
DBStore that causes temporary meta IDs not being remapped after
successful commits. Please file a bugzilla.

If you want to go ahead, please try out the MEMStore instead of the DBStore:

IStore store = MEMStoreUtil.createMEMStore();

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper





Am 11.02.2010 17:23, schrieb Sabri Skhiri:
> Eike,
> I have tried by creating a transaction with the CDO UI Client. The
> creation of an empty resource works, but if I try to create something
> within this resource it fails when I commit with this same strange
> exception. The same if I try from a client Transaction API.
>
> Therefore, I downloaded all the CDO 3.0 sources from repository and I
> re-test the same use case, it fails with the same exception.
> Have you got any idea ?
> Thank you,
>
> Sabri.


Re: [CDO] Transaction Exception [message #514394 is a reply to message #514036] Mon, 15 February 2010 08:33 Go to previous message
Sabri Skhiri is currently offline Sabri SkhiriFriend
Messages: 43
Registered: February 2010
Member
OK thanks ! By replacing the DB store it works indeed.
I will fill in a bugzilla.

thanks for the support.
Previous Topic:[CDO] instance objects and java Serializable
Next Topic:Is it possible to save more than one object in one resource?
Goto Forum:
  


Current Time: Fri Apr 19 12:29:40 GMT 2024

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

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

Back to the top