I just got bit by this, despite the fact I had read this thread. I forgot and coded a method that asked if an object is persistant, and if not caused it to get a new ID and make itself persistant.

I noticed something interesting though.... I edited and changed an object, then inadvertently created a copy of it because of the ID aquisition issue I just described, but when I did another extent to display a list of all items, both the old object and the inadvertently created object were identical right down to the ID. Logging intto mysql and doing a select shows that this is not what has happened in the DB. So it looks like the transient objects returned by the extent are still cached objects and may become modified without effecting the database.

This means that data can appear to be written to the database but in fact is not!

I hope you will have time to work on this very soon, I'm digging through the discussion referenced below and having trouble picking out what exactly the work around is... If you or someone else could post a direct workaround for getting a list of all objects of a class that are persistant it would help a lot.

TIA,
Gus

Mahler Thomas wrote:

Hi Nick,




Hi-

An earlier thread on this list:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03832.html
describes a _serious_ bug in the JDO interface to OJB.

I posted about this last week and haven't gotten a response yet. I'm
really hoping that someone can shed some light on the status of this
issue, otherwise it just doesn't make sense to use the JDO API at all.



This bug is still open. (Lazy me) I've started to work on the issue, but did not get very far yet. As I'm currently very busy I can't make any promises when it will be fixed.

cheers,
Thomas




Thanks,
Nick



-----Forwarded Message-----

From: Nick Ohanian <[EMAIL PROTECTED]>
To: OJB Users List <[EMAIL PROTECTED]>
Subject: JDO Query/Extent Problem
Date: 14 Nov 2003 00:38:55 -0800

Hi-

There was a thread on this list regarding the fact that when using JDO,
Extent or Query results act transient, not persistent. That is, if you
look up an object with a Query and edit it, those changes are not
persisted back to the database on commit. The only way to get a
"really" persistent object is to look it up by an Identity.


Note that this is the kind of lookup used by Tutorial 4. Indeed if you
look at the source for UCEditProduct (the actual file in src/jdori/org/apache/ojb/tutorial5/UCEditProduct.java, not the source on
the Tutorial 4 web page), you can see that the use of a Query object
appears to be commented out in place of the Identity object.


The thread that I'm referring to can be found here (it explains things
in some more detail):
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03832.html

This makes the JDO API... less than ideal. ;)

Has this problem been addressed already? Is there a fix available?

Thanks so much,
Nick





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to