mchyzer wrote:
Im in hibernate 3, and have a general question. If this is in the docs, kindly point me to which one.
This is my understanding of how hibernate works (in pseudocode):
1. retrieve an object
2. edit the object
3. insert an object into the session
4. close and commit
Both objects will get persisted to the DB (the one that was retrieved and edited, and the one that was explicitly inserted).
This is how I am considering going (since I want to reduce the magic happening to make DB stores explicit).
In the same 4 steps above, only the inserted object gets persisted. To get both to be persisted, you do this:
1. retrieve an object
2. edit the object
3. insert an object into the session
4. store the retrieved and edited object
5. close and commit
So basically all retrieved objects are detached by default. And I realize this kills any caching. Thats ok. Is there a setting to do this be default or do I need to detach after retrieving each one?
Thanks,
Chris
5. commit Tx THEN close Session