I want to create a query from the primary key. It is believed that I have the class primary key, the person name, the name of the property and the ID.
I have a person class, property is PersonKey, address, DOB
Now, I want to find the person by the primary key.
First of all, I make an example of PersonKey, and the name becomes: joe, and id becomes: 007
Can I pass a person to the ID key variable ???
person.findByKey (someKey); , But do not use logic criteria
Yes you can accept PersonKey
serializable
, simply pass it to the get
method:
PersonKey pk = new PersonKey (007l, "joe"); Person person = (person) session.get (person class, pk);
Comments
Post a Comment