question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache JDO Project > question




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    question  
Karan Malhi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-29-07 12:11 AM

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






[ Post a follow-up to this message ]



    Re: question  
Craig L Russell


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-29-07 06:11 AM






[ Post a follow-up to this message ]



    RE: question  
Karan Malhi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-29-07 06:11 PM

Thanks Craig,
 
Some more follow up questions.
"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."
 
so if I do pm.makePersistent(obj);
Object objectid = pm.getObjectId(obj);
I am assuming JDO will assign this object an ID. lets say it is 10
What happens if I rollback the transaction?
Also, what happens if before I commit, some other tx uses 10 and inserts a r
ow
When I commit, will i get an exception? This would be somewhat unexpected I 
guess, so I think I did not understand it properly
 
"The assignment of the object id depends to a large extent on the 
user's metadata for the class. Several strategies can be used."
 
Where exactly in the metadata do I specify this?
 
Thanks for the help
Regards

Karan Singh


________________________________

From: Craig L Russell [mailto:Craig.Russell@Sun.COM]
Sent: Thu 6/28/2007 8:34 PM
To: Apache JDO project; JDO Expert Group
Subject: Re: question



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!









[ Post a follow-up to this message ]



    Re: question  
Craig L Russell


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-01-07 12:11 AM






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:02 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register