Hibernate version: 2.1
Scenario: Two stateless session beans (EJBs) in an application server:
EJB1 gets a new session
EJB1 creates an object 'A' and calls session.save();
EJB1 then calls EJB2, passing the ID of Object 'A'
EJB2 gets a new session
EJB2 loads object 'A' from with session.load(ID);
EJB2 changes a value in object 'A'
EJB2 returns
EJB1 does nothing, but can see the changed value in object 'A'
My questions:
1) How does EJB2 manage to see Object 'A' if it has not been flushed/commited to the database?
- Is the updated session passed to EJB2???
2) Are EJB1 and EJB2 actually using the same session as this is only one transaction?
3) If my application servers were clustered, would this fail if EJB1 was on a different node to EJB2?
Thank you for any help, I'm quite confused as to the caching by Hibernate, even after reading the HIA book, and running the scenario above!
|