http://forum.hibernate.org/old/914765.html talks around the issue I am
having but it doesn't really solve anything.
 
 
We start with an object manually created. 
>>    MyItem myItem = new MyItem(id, name, desc);
 
I then check to see if it already exists.  To determine if I want to do an update or a save.
 
>>    MyItem fromDatabase = (MyItem)session.load(MyItem.class, dblItem.getId());
 
If fromDatabase existed, I want to update it with the data from myItem.
Because you can't just do an update(myItem) since fromDatabase is already loaded.
(Note: you can't do a update(myItem) even if you hadn't called the load - because the session doesn't recognise it to update.)
The only way I can see doing this now is to transfer the field values from myItem to fromDatabase.
(Note: using the reflect package to do this is fairly trivial - but just more work )
 If there was some way to updateSimilar or updateFromClone or similar method that would allow an update with a different object, that would be nice to have.
 


Cheers

Troy

Reply via email to