orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Object DB: Saving POJOs inside a Transaction

Open dxxr opened this issue 12 years ago • 2 comments

OrientDB v1.6.3

With no transactions it is possible to save a POJO to the database, which always results in an INSERT operation.

In contrast, saving a POJO inside a transaction leads to an exception stating that the object needs an @Version annotated field. But this would introduce an otherwise unnecessary dependency on the JPA to my simple data beans.

As a workaround, I'm currently creating proxied instances via db.newInstance() which can be saved inside the transaction. But this approach requires an open database connection where the instances are created, which I otherwise wouldn't need.

It would be nice if inserting a POJO into the database would also work inside transactions.

dxxr avatar Feb 21 '14 18:02 dxxr

As another oddity I noticed the following: I have a DB-Proxy object instance loaded from the database with a List<> property mapped to a LINKLIST in the database. I then insert freshly created plain (non-proxy) object instances into that List<> property. It is now possible to save named proxy object instance to the database without getting any exceptions about missing @Version annotations...

dxxr avatar May 26 '14 16:05 dxxr

Not relevant anymore, closing it.

lvca avatar Aug 03 '17 13:08 lvca