Hi Karan,
In JDO, an object id is like Schroedinger's cat [1]. You don't know
what it is until you ask for it, or the implementation needs it. This
is because in many cases, you need to round trip to the database to
create the id and it's more efficient if you can defer the database
trip until the transaction commits.
Anyway, the implementation is required to actually assign an id only
at the point in time when you either flush the instance or ask for
the object id via getObjectId. Once assigned, the id won't change.
Of course, there's nothing to stop the implementation from eagerly
assigning the id during the makePersistent call.
The assignment of the object id depends to a large extent on the
user's metadata for the class. Several strategies can be used.
Craig
[1] http://en.wikipedia.org/wiki/Schrödinger's_cat
On Jun 28, 2007, at 1:50 PM, Karan Malhi wrote:
> Does a persistent-new object have an objectID. If yes, then what is
> the value stored in that? How does JDO determine what value to store
> in it?
>
> --
> Karan Malhi
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
|