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

Examples of org.apache.cayenne.jpa.itest.ch2._2_1_6_MappingDefaultsNonRelationshipTest


        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(
                "PropertyDefaultsOtherEntity",
                "string"));
        assertEquals(2, getDbHelper().getInt("PropertyDefaultsOtherEntity", "bigInt"));
        assertEquals(3.5d, getDbHelper().getDouble(
                "PropertyDefaultsOtherEntity",
                "bigDecimal"));

        byte[] b1 = getDbHelper().getBytes("PropertyDefaultsOtherEntity", "byteArray");
        assertNotNull(b1);
        assertEquals(2, b1.length);
        assertEquals((byte) 1, b1[0]);
        assertEquals((byte) 2, b1[1]);

        byte[] b2 = getDbHelper().getBytes(
                "PropertyDefaultsOtherEntity",
                "byteWrapperArray");
        assertNotNull(b2);
        assertEquals(2, b2.length);
        assertEquals((byte) 1, b2[0]);
        assertEquals((byte) 2, b2[1]);

        assertEquals("ab", getDbHelper().getObject(
                "PropertyDefaultsOtherEntity",
                "charArray"));

        assertEquals("ab", getDbHelper().getObject(
                "PropertyDefaultsOtherEntity",
                "charWrapperArray"));
        assertEquals(1, getDbHelper().getInt("PropertyDefaultsOtherEntity", "enumType"));

        byte[] ser = getDbHelper().getBytes(
                "PropertyDefaultsOtherEntity",
                "serializableType");
        assertNotNull(ser);
        SerializableType so = (SerializableType) new ObjectInputStream(
                new ByteArrayInputStream(ser)).readObject();
        assertNotNull(so);
        assertEquals("c", so.getKey());
    }
View Full Code Here


                "PropertyPersistenceEntity",
                "property1"));
    }

    public void testSkipTransientProperties() {
        TransientFieldsEntity o1 = new TransientFieldsEntity();
        getEntityManager().persist(o1);
        getEntityManager().getTransaction().commit();
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.jpa.itest.ch2._2_1_6_MappingDefaultsNonRelationshipTest

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.