Suppose I have the following running in a Stateless session bean method inside a container managed transaction:
Code:
// begin transaction (container)
Session session = factory.openSession();
Product x = session.load(Product.class, id);
String oldProductName = x.getName(); // foo
String newProductName = "bar"
x.setName(newProductName);
session.close();
Session session2 = factory.openSession();
Product x2 = session2.load(Product.class, id);
String nameInSecondSession = x2.getName();
session2.close()
// end transaction (container)
What is the value of nameInSecondSession? Is the data somehow 'shared' in the transaction?
My gut feel says that the x2.getName() should return "foo", but I would like to confirm. I currently don't have access to an application server in order to execute such a test and would therefore appreciate any feedback. Is there another way (without an app server) to check?