TC >I meant : old object = exists in the database
TC >
TC >Here is the code snippet from my other post from a few minutes ago...
TC >I only get exception (about duplicate objects) when trying to commit, not
TC >sooner
TC >(with autostore = true)
TC >
TC >try {
TC >t = new Test(70);
TC >// company id=30 already exists in the DB, we just want to fetch it for
TC >reference
TC >Company co = (Company) pm.findByPrimaryKey(test.Company.class, new
TC >Integer(30));
TC >t.setOwnerCompany(co);
TC >System.out.println("Co ++ " + co);
TC >System.out.println("test " + t);
TC >pm.create(t);
TC >}
TC >catch (Exception ex) {
TC >


Notice this reply from Thomas Yip:

>>The old object is not an existing object in the Castor world. It is only
>>something outside the atmosphere.
>>It is a mis-use. You should load the object again via Castor.
>>Or, use long transaction update to made Castor aware of the out-of-space
>>object.

Take a look at org.exolab.castor.jdo.Database.update(). Also why
are you using a pm.create()? I believe that this is part of the
problem. If I'm not mistaken, this forces a create. commit() might
have been a better choice here.

--

perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to