{
AddressB11FK address = new AddressB11FK();
address.setAddressId("addr1");
address.setStreet("street");
PersonB11FK p1 = new PersonB11FK();
p1.setPersonName("vivek");
p1.setPersonId("1");
p1.setAddress(address);
em.persist(p1);
PersistenceDelegator delegator = CoreTestUtilities.getDelegator(em);
Map<String, Object> relationMap = new HashMap<String, Object>();
relationMap.put("ADDRESS_ID", "addr1");
EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(
((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), PersonB11FK.class);
p1.setAddress(null);
CoreTestEntityReader reader = new CoreTestEntityReader(kunderaMetadata);
reader.recursivelyFindEntities(p1, relationMap, metadata, delegator, false);
Assert.assertNotNull(p1.getAddress());
Assert.assertTrue(ProxyHelper.isKunderaProxy(p1.getAddress()));
p1.setAddress(null);
reader.recursivelyFindEntities(p1, relationMap, metadata, delegator, true);
Assert.assertNotNull(p1.getAddress());
Assert.assertFalse(ProxyHelper.isKunderaProxy(p1.getAddress()));
Assert.assertEquals(p1, p1.getAddress().getPerson());
}