Package com.impetus.kundera.polyglot.entities

Examples of com.impetus.kundera.polyglot.entities.PersonUMMByMap


    @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.
View Full Code Here


   
    @Test
    public void testByMap() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
    {
        setup("patest");
        PersonUMMByMap person = new PersonUMMByMap();
        person.setPersonId("1");
        person.setPersonName("personName");
       
        AddressUMM address = new AddressUMM();
       
        Map<String,AddressUMM> addresses = new HashMap<String,AddressUMM>();
        addresses.put("addr1",address);
       
        person.setAddresses(addresses);

        Relation relation = new Relation(PersonUMMByMap.class.getDeclaredField("addresses"), AddressUMM.class,
                Set.class, FetchType.LAZY, null, false, null, ForeignKey.MANY_TO_MANY);
        PersistenceDelegator delegator = CoreTestUtilities.getDelegator(em);
        ProxyMap proxyMap = new ProxyMap(delegator, relation);
View Full Code Here

TOP

Related Classes of com.impetus.kundera.polyglot.entities.PersonUMMByMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.