• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Manu Somasekhar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic