Regular |
 |
Joined: Tue Sep 26, 2006 11:37 am Posts: 115 Location: Sacramento, CA
|
One way that makes sense to me is the following:
1. you start the interaction and have the ID or some other property
2. at once you load the object from the database and start using
3. as part of using the object you set it's transient field
4. when you delete from the db you still have the transient field (with the rest of the object in memory)
It doesn't make sense to me that you would set the transient field on an object that is not the proper object. Either the transient field is tightly coupled to the object and you know before hand which object that is, or this field is not tightly coupled to the object in which case you can store it in some other data structure that you manage.
Maybe you are using this as part of some framework like Struts2 and the transient property comes from a form field. In that case you can either store into a different object in the action object or if you insist on storing in the persistent object you have to save a copy before loading the object then storing back in the object. Even better load into a new variable and copy/merge the relevant fields from the old variable.
Hope this helps.
|
|