Examples of SimpleEntity


Examples of org.apache.cayenne.jpa.itest.ch3.entity.SimpleEntity

                "id", "property1"
        }, new Object[] {
                1, "XXX"
        });

        SimpleEntity e1 = (SimpleEntity) getEntityManager().find(SimpleEntity.class, 1);
        assertNotNull(e1);
        getEntityManager().remove(e1);
        getEntityManager().getTransaction().commit();

        assertEquals(0, getDbHelper().getRowCount("SimpleEntity"));
View Full Code Here

Examples of org.apache.cayenne.jpa.itest.ch3.entity.SimpleEntity

        }
    }

    public void testRemoveDetachedEntity() throws Exception {
        try {
            getEntityManager().remove(new SimpleEntity());
            fail("Must have thrown IllegalArgumentException on detached entity");
        }
        catch (IllegalArgumentException e) {
            // expected
        }
View Full Code Here

Examples of org.apache.cayenne.jpa.itest.ch3.entity.SimpleEntity

            // Per spec, The EntityTransaction instance may be used serially to
            // begin and commit multiple transactions

            tx.begin();
            SimpleEntity e1 = new SimpleEntity();
            e1.setProperty1("X");
            entityManager.persist(e1);
            tx.commit();

            tx.begin();
            SimpleEntity e2 = new SimpleEntity();
            e2.setProperty1("Y");
            entityManager.persist(e2);
            tx.commit();
        }
        finally {
            entityManager.close();
View Full Code Here

Examples of org.apache.cayenne.jpa.itest.ch5.entity.SimpleEntity

        EntityManager entityManager = ItestSetup
                .getInstance()
                .createContainerManagedEntityManager();

        SimpleEntity e = new SimpleEntity();
        e.setProperty1("XXX");
        entityManager.persist(e);
        tm.commit();

        assertEquals(1, getDbHelper().getRowCount("SimpleEntity"));
    }
View Full Code Here

Examples of org.apache.cayenne.jpa.itest.ch5.entity.SimpleEntity

        EntityManager entityManager = ItestSetup
                .getInstance()
                .createContainerManagedEntityManager();

        SimpleEntity e = new SimpleEntity();
        e.setProperty1("XXX");

        assertFalse(OpenEJBContainer.getContainer().isActiveTransaction());

        // throws TransactionRequiredException if invoked on a
        // container-managed entity manager of type
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.SimpleEntity

       
        // then
        assertEquals(oid, adapter.getOid());
        assertEquals(ResolveState.GHOST, adapter.getResolveState());

        final SimpleEntity epv = (SimpleEntity)adapter.getObject();
        assertEquals("Fred", epv.getName());
        assertNotNull(adapter.getVersion());
    }
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.SimpleEntity

    }

    @Test
    public void recreateObject_valuePreserved() throws Exception {
        recreatedAdapter = mementoForEpv1.recreateObject();
        final SimpleEntity recreatedObject = (SimpleEntity)recreatedAdapter.getObject();
        assertEquals("Fred", recreatedObject.getName());
    }
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.SimpleEntity

    @Test
    public void recreateObject_referencePreserved() throws Exception {
        recreatedAdapter = mementoForEpr1.recreateObject();
        final ReferencingEntity recreatedObject = (ReferencingEntity)recreatedAdapter.getObject();
        final SimpleEntity reference1 = recreatedObject.getReference();
        assertNotNull(reference1);
       
        assertThat("Fred", equalTo(reference1.getName()));
    }
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.SimpleEntity

        final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
        final List<BaseEntity> hetrogenousCollection = recreatedObject.getHeterogeneousCollection();
        assertNotNull(hetrogenousCollection);
       
        assertThat(hetrogenousCollection.size(), is(2));
        final SimpleEntity firstObj = (SimpleEntity)hetrogenousCollection.get(0);
        assertThat(firstObj.getName(), is("Fred"));
       
        final ReferencingEntity secondObj = (ReferencingEntity)hetrogenousCollection.get(1);
        final SimpleEntity reference1 = secondObj.getReference();
        assertThat(reference1.getName(), is("Fred"));
       
        assertSame(firstObj, reference1);
    }
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.SimpleEntity

        final Set<Object> objects = persistor.loadData(reader);

        assertEquals(1, objects.size());
        final Object object = objects.toArray()[0];
        assertThat(object instanceof SimpleEntity, is(true));
        final SimpleEntity epv = (SimpleEntity) object;
        assertEquals("Fred Smith", epv.getName());
       
        assertEquals(dateFormat.parse("08-Mar-2010 01:00 GMT"), epv.getDate());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.