@Test
public void testManyToManyByMap() throws NoSuchFieldException, SecurityException, IllegalArgumentException,
IllegalAccessException
{
PersonUMMByMap person = new PersonUMMByMap();
person.setPersonId("person1");
person.setPersonName("personName");
AddressUMM address = new AddressUMM();
address.setAddressId("addr1");
address.setStreet("mtmstreet");
Map<String, AddressUMM> addresses = new HashMap<String, AddressUMM>();
addresses.put("addr1", address);
person.setAddresses(addresses);
em.persist(person);
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(), PersonUMMByMap.class);
CoreTestEntityReader reader = new CoreTestEntityReader(kunderaMetadata);
person.setAddresses(null);
reader.recursivelyFindEntities(person, relationMap, metadata, delegator, false);
Assert.assertNotNull(person.getAddresses());
Assert.assertTrue(ProxyHelper.isKunderaProxyCollection(person.getAddresses()));
reader.recursivelyFindEntities(person, relationMap, metadata, delegator, true);
Assert.assertTrue(person.getAddresses().isEmpty()); // code to fetch
// from join table
// data in dummy
// client is
// missing.