Package org.apache.cayenne.jpa.itest.ch2.entity

Examples of org.apache.cayenne.jpa.itest.ch2.entity.BidiOneToManyOwned


import org.apache.cayenne.jpa.itest.ch2.entity.NoPkEntity;

public class _2_1_4_PrimaryKeyAndIdentityTest extends EntityManagerCase {

    public void testNoPkEntity() {
        NoPkEntity o1 = new NoPkEntity();

        try {
            getEntityManager().persist(o1);
        }
        catch (IllegalArgumentException e) {
View Full Code Here


        timeCal.set(Calendar.MINUTE, 44);
        timeCal.set(Calendar.SECOND, 32);
        Time time = new Time(timeCal.getTimeInMillis());
        Timestamp timestamp = new Timestamp(utilDate.getTime() - 50);

        PropertyDefaultsDatesEntity o1 = new PropertyDefaultsDatesEntity();
        o1.setUtilDate(utilDate);
        o1.setCalendar(calendar);
        o1.setSqlDate(sqlDate);
        o1.setSqlTime(time);
        o1.setSqlTimestamp(timestamp);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals(utilDate, getDbHelper().getUtilDate(
View Full Code Here

    }

    public void testOtherDefaults() throws Exception {
        getDbHelper().deleteAll("PropertyDefaultsOtherEntity");

        PropertyDefaultsOtherEntity o1 = new PropertyDefaultsOtherEntity();
        o1.setString("abc");
        o1.setBigInt(new BigInteger("2"));
        o1.setBigDecimal(new BigDecimal("3.5"));
        o1.setByteArray(new byte[] {
                1, 2
        });
        o1.setByteWrapperArray(new Byte[] {
                new Byte("1"), new Byte("2")
        });

        o1.setCharArray(new char[] {
                'a', 'b'
        });
        o1.setCharWrapperArray(new Character[] {
                new Character('a'), new Character('b')
        });

        o1.setEnumType(EnumType.b);
        o1.setSerializableType(new SerializableType("c"));

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals("abc", getDbHelper().getObject(
View Full Code Here

    }

    public void testPrimitiveDefaults() throws Exception {
        getDbHelper().deleteAll("PropertyDefaultsPrimitiveEntity");

        PropertyDefaultsPrimitiveEntity o1 = new PropertyDefaultsPrimitiveEntity();
        o1.setPrimitiveBoolean(true);

        o1.setPrimitiveByte((byte) 3);
        o1.setPrimitiveShort((short) 2);
        o1.setPrimitiveInt(4);
        o1.setPrimitiveChar('a');
        o1.setPrimitiveLong(1234567890l);
        o1.setPrimitiveFloat(5.5f);
        o1.setPrimitiveDouble(6.5d);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertTrue(getDbHelper().getBoolean(
View Full Code Here

    }

    public void testPrimitiveWrapperDefaults() throws Exception {
        getDbHelper().deleteAll("PropertyDefaultsWrapperEntity");

        PropertyDefaultsWrapperEntity o1 = new PropertyDefaultsWrapperEntity();

        o1.setBooleanWrapper(Boolean.TRUE);
        o1.setByteWrapper(new Byte("3"));
        o1.setShortWrapper(new Short("2"));
        o1.setIntWrapper(new Integer("4"));
        o1.setCharWrapper(new Character('a'));
        o1.setLongWrapper(new Long(1234567890l));
        o1.setFloatWrapper(new Float("5.5"));
        o1.setDoubleWrapper(new Double("6.5"));

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertTrue(getDbHelper().getBoolean(
View Full Code Here

    public void testPropertyEmbeddable() throws Exception {
        getDbHelper().deleteAll("PropertyEmbeddedEntity");

        PropertyEmbeddedEntity o1 = new PropertyEmbeddedEntity();
        PropertyEmbeddable o2 = new PropertyEmbeddable();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();
View Full Code Here

    }

    public void testPropertyEmbeddable() throws Exception {
        getDbHelper().deleteAll("PropertyEmbeddedEntity");

        PropertyEmbeddedEntity o1 = new PropertyEmbeddedEntity();
        PropertyEmbeddable o2 = new PropertyEmbeddable();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals("p1", getDbHelper().getObject("PropertyEmbeddedEntity", "property1"));
View Full Code Here

    }

    public void testPropertyBasedPersistence() throws Exception {
        getDbHelper().deleteAll("PropertyPersistenceEntity");

        PropertyPersistenceEntity o1 = new PropertyPersistenceEntity();
        o1.setProperty1("p1");
        o1.setProperty2(true);
        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals("p1", getDbHelper().getObject(
                "PropertyPersistenceEntity",
View Full Code Here

     */
    public void testSerializableEmbeddable() throws Exception {
        getDbHelper().deleteAll("SerializableEmbeddedEntity");

        SerializableEmbeddedEntity o1 = new SerializableEmbeddedEntity();
        SerializableEmbeddable1 o2 = new SerializableEmbeddable1();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

View Full Code Here

     * and handled just as regular embeddables.
     */
    public void testSerializableEmbeddable() throws Exception {
        getDbHelper().deleteAll("SerializableEmbeddedEntity");

        SerializableEmbeddedEntity o1 = new SerializableEmbeddedEntity();
        SerializableEmbeddable1 o2 = new SerializableEmbeddable1();
        o2.setProperty1("p1");
        o1.setEmbeddable(o2);

        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();

        assertEquals("p1", getDbHelper().getObject(
View Full Code Here

TOP

Related Classes of org.apache.cayenne.jpa.itest.ch2.entity.BidiOneToManyOwned

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.