* test the definition of a fetch-group in the jdo file with a a.b.c field
* <field name="a.b.c">
*/
public void testRefreshReference() {
logger.log(BasicLevel.DEBUG, "***************testRefreshReference*****************");
Country country = new Country("it","Italie");
Address address = new Address("Rue Spiaggi", "Milan", country);
Person parent = new Person();
parent.setName("Del Piero Joel");
parent.setAge(32);
parent.setAddress(address);
Person child1 = new Person("Del Piero Sophie", address, null, 14);
Person child2 = new Person("Del Piero Mikael", address, null, 11);
Set children = new HashSet();
children.add(child1);
children.add(child2);
parent.setChildren(children);
PersistenceManager pm = pmf.getPersistenceManager();
try {
FetchPlan fp = pm.getFetchPlan();
fp.clearGroups();
fp.addGroup("detail").removeGroup("default");
pm.currentTransaction().begin();
logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
pm.makePersistent(parent);
Object id = pm.getObjectId(parent);
pm.currentTransaction().commit();
logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
pm.currentTransaction().begin();
//update the age and the address
parent.setAge(99);
Address newAddress = new Address("rue Ampere", "Rennes", new Country("bz", "Bretagne"));
parent.setAddress(newAddress);
pm.refresh(parent);
pm.currentTransaction().commit();
assertEquals(32, parent.getAge());
assertEquals(address.getCity(), parent.getAddress().getCity());