History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word | Printable)

Key: CORE-3484
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Ray Hu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JPOX Core

Update newly created object failed.Exception show that the object's version is not in memory.

Created: 08/Jan/08 05:24 PM   Updated: 16/Jan/08 11:04 AM
Component/s: JDO
Affects Version/s: 1.2.0-beta-5
Fix Version/s: 1.2.0-rc-1

File Attachments: 1. Zip Archive test.zip (3 kb)

Environment: WinXP,Postgresql2.5.1

Forum Thread URL: http://www.jpox.org/servlet/forum/viewthread?thread=4819
Datastore: PostgreSQL


 Description  « Hide
Update newly created object failed.Exception show that the object's version is not in memory.
Object's version is using a field in class.

[java] 23:58:58,170 (main) DEBUG [JPOX.Persistence] - The Implementation creator org.jpox.enhancer.asm.ASMImplementationCreator is ready for use.
     [java] 23:58:58,170 (main) DEBUG [JPOX.Persistence] - Object Manager "org.jpox.ObjectManagerImpl@ed662d" opened for datastore "org.jpox.store.rdbms.RDBMSManager@1275d39"
     [java] 23:58:58,210 (main) DEBUG [JPOX.Persistence] - Making object persistent : "org.jpox.test.B@5b0668"
     [java] 23:58:58,320 (main) DEBUG [JPOX.Persistence] - Object "org.jpox.test.B@5b0668" has been marked for persistence but its actual persistence to the datastore will be delayed due to use of optimistic transactions or "delayDatastoreOperationsUntilCommit"
     [java] 23:58:58,400 (main) DEBUG [JPOX.Persistence] - ObjectManager internalFlush() process started - 1 dirty objects
     [java] 23:58:58,410 (main) DEBUG [JPOX.Persistence] - Object "org.jpox.test.B@5b0668" being inserted into table "b"
     [java] 23:58:59,371 (main) DEBUG [JPOX.Datastore.Persist] - INSERT INTO b ("version","name") VALUES (<1>,<'b0'>)
     [java] 23:58:59,472 (main) DEBUG [JPOX.Datastore.Persist] - Execution Time = 101 ms (number of rows = 1)
     [java] 23:58:59,472 (main) DEBUG [JPOX.Datastore.Retrieve] - SELECT currval('b_oid_seq')
     [java] 23:58:59,472 (main) DEBUG [JPOX.Datastore.Retrieve] - Execution Time = 0 ms
     [java] 23:58:59,472 (main) DEBUG [JPOX.Datastore.Persist] - Object "org.jpox.test.B@5b0668" was inserted in the datastore and was given strategy value of "8"
     [java] 23:58:59,502 (main) DEBUG [JPOX.Persistence] - Insert of object "org.jpox.test.B@5b0668" is calling postInsert for field "org.jpox.test.B.cList"
     [java] 23:58:59,532 (main) DEBUG [JPOX.Persistence] - Object "org.jpox.test.B@5b0668" field "cList" is replaced by a SCO wrapper of type "org.jpox.sco.ArrayList" [cache-values=true, lazy-loading=true, queued-operations=true, allow-nulls=false]
     [java] 23:58:59,532 (main) DEBUG [JPOX.Persistence] - ObjectManager internalFlush() process finished
     [java] 23:58:59,542 (main) DEBUG [JPOX.Persistence] - Object "org.jpox.test.B@5b0668" field "cList" loading contents to SCO wrapper from the datastore
     [java] 23:58:59,932 (main) DEBUG [JPOX.Datastore.Retrieve] - SELECT 'org.jpox.test.C' AS JPOXMETADATA,"element"."name","element".oid,"element"."version",this.integer_idx AS JPOXORDER0 FROM b_clist this INNER JOIN "c" "element" ON "element".oid = this.c_oid WHERE <8> = this.b_oid AND this.integer_idx >= <0> ORDER BY JPOXORDER0
     [java] 23:58:59,932 (main) DEBUG [JPOX.Datastore.Retrieve] - Execution Time = 0 ms
     [java] 23:59:00,022 (main) DEBUG [JPOX.Persistence] - ObjectManager internalFlush() process started - 0 dirty objects
     [java] 23:59:00,022 (main) DEBUG [JPOX.Persistence] - ObjectManager internalFlush() process finished
     [java] 23:59:00,223 (main) DEBUG [JPOX.Datastore.Retrieve] - SELECT 1 FROM b THIS WHERE (THIS.oid = <8>)
     [java] 23:59:00,233 (main) DEBUG [JPOX.Datastore.Retrieve] - Execution Time = 10 ms
     [java] 23:59:00,233 (main) DEBUG [JPOX.Persistence] - Making object persistent : "org.jpox.test.B@5b0668"
     [java] 23:59:00,233 (main) DEBUG [JPOX.Persistence] - Making object persistent : "org.jpox.test.C@2db19d"
     [java] 23:59:00,233 (main) DEBUG [JPOX.Persistence] - Object "org.jpox.test.C@2db19d" has been marked for persistence but its actual persistence to the datastore will be delayed due to use of optimistic transactions or "delayDatastoreOperationsUntilCommit"
     [java] 23:59:00,303 (main) DEBUG [JPOX.Persistence] - ObjectManager internalFlush() process started - 2 dirty objects
     [java] 23:59:00,303 (main) DEBUG [JPOX.Persistence] - Object "org.jpox.test.B@5b0668" having fields "version" updated in table "b"
     [java] 23:59:00,313 (main) ERROR [JPOX.Persistence] - Object with id "org.jpox.test.B$OID::8" in table b has no version set on the object in memory and you want to update it!! Please report this bug to the developers of JPOX
     [java] 23:59:00,313 (main) DEBUG [JPOX.Persistence] - ObjectManager internalFlush() process finished
     [java] 23:59:00,313 (main) DEBUG [JPOX.Persistence] - Disconnecting org.jpox.test.C@2db19d from JDOStateManagerImpl[pc=org.jpox.test.C@2db19d, lifecycle=P_NEW]

// Create B
tx.begin();
B b0 = new B("b0");
pm.makePersistent(b0);
tx.commit();

// add C to B
tx.begin();
b0 = (B)pm.getObjectById(JDOHelper.getObjectId(b0));

//pm.refresh(b0); // Workaround: Using refresh so b0 can get version
C c0 = new C("c0");
b0.cList.add(c0);
pm.makePersistent(b0);
tx.commit();

 All   Comments   Change History      Sort Order:
Ray Hu [16/Jan/08 02:09 AM]
The testing database is Postgresql 8.2.5,not 2.5.1.

Andy Jefferson [16/Jan/08 11:04 AM]
SVN trunk sets the version of the object itself on insert