File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to retrieve an object from the data store using Datanucleus access platform? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to retrieve an object from the data store using Datanucleus access platform?" Watch "How to retrieve an object from the data store using Datanucleus access platform?" New topic
Author

How to retrieve an object from the data store using Datanucleus access platform?

Manu Somasekhar
Ranch Hand

Joined: May 22, 2012
Posts: 44
Hi,
I was playing with Datanucleus. I was able to retrieve an object from the data store using id.




So far so good. But i am not able find an example which is showing how to get an object which is already persisted. What I am trying to say is that I may not have the id (which is an Object) with me all the time.
There is a method in JDO 3 Specification saying Persistencemanager.retrieveObject() which uses the jdo object as the argument. Any one please provide a link or something to a valid example?
Manu Somasekhar
Ranch Hand

Joined: May 22, 2012
Posts: 44
Okay after 4 Hrs I was able to crack it. I am posting the answer so that any other miserable soul with the same problem can solve it

If our application is responsible for providing primary key, the JDO annotation in the class should be something like this.





and persist it. later when you want it back go for it with the code



where 564 is the id which i set when i persisted the object.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrieve an object from the data store using Datanucleus access platform?