Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Error saving an EByteArray(How does CDO map an EByteArray to a database)
[CDO] Error saving an EByteArray [message #1840377] Tue, 13 April 2021 13:44 Go to next message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
Hi all,

I created a model to store (among others) image data as a byte array. I used EByteArray as the datatype for the feature.
When I try to save that into CDO (backed by a Postgres database) I get the following stack trace. How should I proceed?

Thanks,
Ewoud
---

[INFO] org.eclipse.emf.cdo.util.CommitException: Rollback in DBStore: org.eclipse.net4j.db.DBException: org.postgresql.util.PSQLException: Cannot cast an instance of [B to type Types.BLOB
[INFO] at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalBranchingClassMapping.writeValues(HorizontalBranchingClassMapping.java:475)
[INFO] at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalBranchingClassMapping.writeRevision(HorizontalBranchingClassMapping.java:676)
[INFO] at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:651)
[INFO] at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:616)
[INFO] at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeNewObjectRevisions(DBStoreAccessor.java:600)
[INFO] at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:119)
[INFO] at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.doWrite(DBStoreAccessor.java:935)
[INFO] at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:144)
[INFO] at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.writeAccessor(TransactionCommitContext.java:1896)
[INFO] at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:820)
[INFO] at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:49)
[INFO] at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
[INFO] at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:95)
[INFO] at org.eclipse.emf.cdo.internal.server.Repository.commitUnsynced(Repository.java:1378)
[INFO] at org.eclipse.emf.cdo.internal.server.Repository.commit(Repository.java:1371)
[INFO] at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:318)
[INFO] at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:103)
[INFO] at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:118)
[INFO] at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:87)
[INFO] at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:100)
[INFO] at org.eclipse.net4j.signal.Signal.doInput(Signal.java:391)
[INFO] at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:73)
[INFO] at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:66)
[INFO] at org.eclipse.net4j.signal.Signal.runSync(Signal.java:297)
[INFO] at org.eclipse.net4j.signal.Signal.run(Signal.java:169)
[INFO] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[INFO] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[INFO] at java.lang.Thread.run(Thread.java:748)
[INFO] Caused by: org.postgresql.util.PSQLException: Cannot cast an instance of [B to type Types.BLOB
[INFO] at org.postgresql.jdbc.PgPreparedStatement.setObject(PgPreparedStatement.java:645)
[INFO] at org.postgresql.jdbc.PgPreparedStatement.setObject(PgPreparedStatement.java:902)
[INFO] at org.eclipse.net4j.db.jdbc.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:300)
[INFO] at org.eclipse.emf.cdo.server.db.mapping.AbstractTypeMapping.doSetValue(AbstractTypeMapping.java:266)
[INFO] at org.eclipse.emf.cdo.server.db.mapping.AbstractTypeMapping.setValue(AbstractTypeMapping.java:155)
[INFO] at org.eclipse.emf.cdo.server.db.mapping.AbstractTypeMapping.setValueFromRevision(AbstractTypeMapping.java:111)
[INFO] at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalBranchingClassMapping.writeValues(HorizontalBranchingClassMapping.java:454)
[INFO] ... 27 more
[INFO] [4/13/21 12:22:32:477 CEST] 0000003a SystemErr R at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:99)
[INFO] [4/13/21 12:22:32:478 CEST] 0000003a SystemErr R at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commitSynced(CDOTransactionImpl.java:1673)
[INFO] [4/13/21 12:22:32:478 CEST] 0000003a SystemErr R at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1626)
[INFO] [4/13/21 12:22:32:481 CEST] 0000003a SystemErr R at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:1592)
[INFO] [4/13/21 12:22:32:481 CEST] 0000003a SystemErr R at nl.tno.esdl.esdldrive.cdo.CDOManager.storeFullResource(CDOManager.java:342)
Re: [CDO] Error saving an EByteArray [message #1840384 is a reply to message #1840377] Tue, 13 April 2021 18:18 Go to previous messageGo to next message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
BTW: the table is/seems correctly created with data type bytea
Re: [CDO] Error saving an EByteArray [message #1840424 is a reply to message #1840384] Thu, 15 April 2021 04:54 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Ewoud,

It's possible that there's a bug in the PostgresAdapter, but I currently can't analyze that because I have no Postgres instance running for tests. A customer of mine plans to use Postgres instead of H2 and they may assign some budget for me to analyze and fix related issues. Until that happens I fear I have to focus on a few more fundamental issues until I can revisit this Postgres problem in my spare time. Do you have a chance to debug and analyze your problem earlier? Of course I'm here to answer specific questions...

Cheers
Eike


Re: [CDO] Error saving an EByteArray [message #1841196 is a reply to message #1840424] Thu, 06 May 2021 08:47 Go to previous messageGo to next message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
Hi Eike,

Thanks for your reply. I'll have a look at it. Shall I create a bugzilla to track this issue and update my findings?

Kind regards,
Ewoud
Re: [CDO] Error saving an EByteArray [message #1841200 is a reply to message #1841196] Thu, 06 May 2021 10:46 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Great! Please submit a bugzilla so that we can follow up on this...

Re: [CDO] Error saving an EByteArray [message #1841627 is a reply to message #1841200] Sun, 23 May 2021 11:47 Go to previous messageGo to next message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
Bugzilla created at https://bugs.eclipse.org/bugs/show_bug.cgi?id=573711. I found a solution for the issue and added a patch to fix this for Postgres in CoreTypeMappings.java

[Updated on: Sun, 23 May 2021 11:48]

Report message to a moderator

Re: [CDO] Error saving an EByteArray [message #1843846 is a reply to message #1840377] Fri, 20 August 2021 11:46 Go to previous messageGo to next message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
Hi Eike,

Could you have a another look at the bugzilla? I have some new findings for which I need your input.

Thanks!
Ewoud
Re: [CDO] Error saving an EByteArray [message #1847567 is a reply to message #1840377] Mon, 01 November 2021 14:03 Go to previous message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
Hi Eike,

I posted an update in the bug report some time ago. I hope that clarifies it a bit.
We could also discuss further in this topic, as it is a bit more visible.

Kind regards,
Ewoud
Previous Topic:[CDO] Prefetch policy
Next Topic:General question about connection between model and "real world"
Goto Forum:
  


Current Time: Thu Apr 25 10:20:05 GMT 2024

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

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

Back to the top