Ok, I've confirmed the bit about not requiring the update () in this instance because I've just loaded it from the session. Thats as per the doc (Chapter 6. Manipulating Persistent Data)
I already had both a flush and a commit in place, so that should all work, but this still doesn't answer my question:
why is the error occurring??
I haven't seen any documentation that says it is NOT ok to do an update on an object loaded in the session.. it just says that u don't **need** to..
The fact that this works fine in JBoss (a number of versions) would support this suggestion.
Quote:
6.4. Updating objects saved or loaded in the current session
Persistent instances (ie. objects loaded, saved, created or queried by the Session) may be manipulated by the application and any changes to persistent state will be persisted when the Session is flushed (see "flushing" below). So the most straightforward way to update the state of an object is to load() it, and then manipulate it directly.
DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );
cat.setName("PK");
sess.flush(); //changes to cat are automatically detected and persisted
It still looks to me like something is broken (probably Orion) , or maybe not, and the Hibernate doc just needs to be a little more explicit about how this case should NOT be handled, as well as how it **can** be handled..
To digress slightly from the main discussion.. I'm curious to see if some other issue would have occurred if I had removed the "update", and just done the flush and commit (where the update was happening on a different Session Bean, in Orion 2.0.2).. I may well check that out, time permitting.