let me explain ... My doubt is how I can acess a bean database state before saving it?
---
Ex:
....
Session session1 = ...
...
Car car = (Car) session1.get(Car.class,"1");
...
session1.close();
....
car.setColor("blue");
...
Session session2 = ...
/*In this moment i want to retrieve the car "1" from the database to compare the values from the database register and the object "car".
Then i do ...
*/
Car car2 = (Car) session2.get(Car.class,"1");
car1.verifyChanges(car2);
session2.update(car1);
/*When i call this method i receive a NonUniqueObjectIdetifier.*/
How can i compare the values from the persistent bean and the deatached bean and after that update or save the deatached object?
Ps.
If you know a better solution for verifying the bean state changes please tell me.
It's like a database constraint verification that depends on the old register value and the new register value.
----
|