Hi,
A refresh appears not to work.
Here is my sample code.
Code:
Address address = new Address()
// code to set primary key
// .
// .
address.setCity("NewYork");
mergedAddress = em.merge(address);
address.setCity("London");
em.getTransaction().begin();
//This will commit the merged address
//The city will be set to NewYork as the address object
// is not attatched, when the city is changed to London
em.getTransaction().commit();
em.refresh(mergedAddress);
// This will output NewYork
System.out.println("MergedAddress.City = " + mergedAddress.getCity());
em.refresh(address);
// This will output London
System.out.println("Address.City = " + address.getCity());
The value London is never persisted, I don't know why it is outputted when address is refreshed doesn't make any sense?
Comments appreciated...