Package com.impetus.kundera.polyglot.entities

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


    {
        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());

    }
View Full Code Here


    }

    @Override
    protected void insert()
    {
        PersonB11FK person = new PersonB11FK();
        person.setPersonId("bionetoonefk_1");
        person.setPersonName("Amresh");

        AddressB11FK address = new AddressB11FK();
        address.setAddressId("bionetoonefk_a");
        address.setStreet("123, New street");
        person.setAddress(address);
        address.setPerson(person);

        dao.insert(person);
    }
View Full Code Here

    @Override
    protected void find()
    {
        // Find Person
        PersonB11FK p = (PersonB11FK) dao.findPerson(PersonB11FK.class, "bionetoonefk_1");
        assertPersonnel(p);      
    }
View Full Code Here

    }

    @Override
    protected void findPersonByIdColumn()
    {
        PersonB11FK p = (PersonB11FK) dao.findPersonByIdColumn(PersonB11FK.class, "bionetoonefk_1");
        assertPersonnel(p);
    }
View Full Code Here

    @Override
    protected void update()
    {
        try
        {
            PersonB11FK p = (PersonB11FK) dao.findPerson(PersonB11FK.class, "bionetoonefk_1");
            assertPersonnel(p);

            dao.merge(p); // This merge operation should do nothing since
                          // nothing has changed

            p = (PersonB11FK) dao.findPerson(PersonB11FK.class, "bionetoonefk_1");
            assertPersonnel(p);

            p.setPersonName("Saurabh");
            p.getAddress().setStreet("Brand New Street");
            dao.merge(p);

            PersonB11FK pAfterMerge = (PersonB11FK) dao.findPerson(PersonB11FK.class,
                    "bionetoonefk_1");
            assertPersonnelAfterUpdate(pAfterMerge);

        }
        catch (Exception e)
View Full Code Here

    }

    @Override
    protected void remove()
    {
        PersonB11FK p = (PersonB11FK) dao.findPerson(PersonB11FK.class, "bionetoonefk_1");
        assertPersonnelAfterUpdate(p);

        dao.remove("bionetoonefk_1", PersonB11FK.class);

        PersonB11FK pAfterRemoval = (PersonB11FK) dao.findPerson(PersonB11FK.class, "bionetoonefk_1");
        Assert.assertNull(pAfterRemoval);
    }
View Full Code Here

    {
        Assert.assertNotNull(address);
        Assert.assertEquals("bionetoonefk_a", address.getAddressId());
        Assert.assertEquals("123, New street", address.getStreet());

        PersonB11FK pp = address.getPerson();
        Assert.assertNotNull(pp);
        Assert.assertEquals("bionetoonefk_1", pp.getPersonId());
        Assert.assertEquals("Amresh", pp.getPersonName());
    }
View Full Code Here

        Assert.assertEquals("Saurabh", pAfterMerge.getPersonName());
        AddressB11FK addressAfterMerge = pAfterMerge.getAddress();
        Assert.assertNotNull(addressAfterMerge);
        Assert.assertEquals("Brand New Street", addressAfterMerge.getStreet());

        PersonB11FK pp = addressAfterMerge.getPerson();
        Assert.assertNotNull(pp);
        Assert.assertEquals("bionetoonefk_1", pp.getPersonId());
        Assert.assertEquals("Saurabh", pp.getPersonName());
    }
View Full Code Here

TOP

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

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.