Examples of AllFieldTypes


Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

    public void setUp() {
        super.setUp(AllFieldTypes.class, CLEAR_TABLES,
            "openjpa.Compatibility", "JPQL=warn");

        AllFieldTypes pc1 = new AllFieldTypes();
        AllFieldTypes pc2 = new AllFieldTypes();
        AllFieldTypes pc3 = new AllFieldTypes();
        AllFieldTypes pc4 = new AllFieldTypes();

        // pc1 and pc2, pc3 and pc4 grouped on intField, shortField
        pc1.setIntField(1);
        pc1.setShortField((short) -1);
        pc2.setIntField(1);
        pc2.setShortField((short) -1);
        pc3.setIntField(2);
        pc3.setShortField((short) -2);
        pc4.setIntField(2);
        pc4.setShortField((short) -2);

        // pc1 and pc2 grouped on stringField
        pc1.setStringField("abc");
        pc2.setStringField("acd");
        pc3.setStringField("def");
        pc4.setStringField("efg");

        // pc2 and pc3 grouped on byteField
        pc2.setByteField((byte) 1);
        pc3.setByteField((byte) 1);
        pc1.setByteField((byte) 0);
        pc4.setByteField((byte) 2);

        // longField is unique id
        pc1.setLongField(1L);
        pc2.setLongField(2L);
        pc3.setLongField(3L);
        pc4.setLongField(4L);

        // set up some relations
        pc1.setSelfOneOne(pc4);
        pc2.setSelfOneOne(pc3);
        pc3.setSelfOneOne(pc2);
        pc4.setSelfOneOne(pc1);

        // if variable testing, set up some 1-Ms instead of the 1-1s above
        if (getName().startsWith("testVariable")) {
            pc1.setSelfOneOne(pc1);
            pc2.setSelfOneOne(pc1);
            pc1.getSelfOneMany().add(pc1);
            pc1.getSelfOneMany().add(pc2);

            pc3.setSelfOneOne(pc3);
            pc4.setSelfOneOne(pc3);
            pc3.getSelfOneMany().add(pc3);
            pc3.getSelfOneMany().add(pc4);
        }

        EntityManager em = emf.createEntityManager();
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

        ClassMetaData cmd = repo.getMetaData(AllFieldTypes.class, null, true);
        try {
            // Don't parameterize this collection to force the JVM to use the
            // ...(ClassMetaData meta, Collection<Object> oids) method sig.
            Collection ids = new ArrayList<AllFieldTypes>();
            ids.add(new AllFieldTypes());
            JPAFacadeHelper.toOpenJPAObjectIds(cmd, ids);
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected

        }
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, "a");
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected

        }
        OpenJPAEntityManagerSPI em = emf.createEntityManager();
        em.getTransaction().begin();
        AllFieldTypes type = new AllFieldTypes();
        em.persist(type);
        em.getTransaction().commit();
        Object oid = em.getObjectId(type);
        assertEquals(Id.class, JPAFacadeHelper.toOpenJPAObjectId(cmd, oid).getClass());
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

            CLEAR_TABLES,
            AllFieldTypes.class, CascadeParent.class, CascadeChild.class);

        OpenJPAEntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        AllFieldTypes pc = new AllFieldTypes();
        pc.setStringField("DeleteMe");
        em.persist(pc);
        oid = em.getObjectId(pc);
        em.getTransaction().commit();
        em.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

    public void setUp() {
        super.setUp(AllFieldTypes.class, CLEAR_TABLES,
            "openjpa.Compatibility", "JPQL=warn");

        AllFieldTypes pc1 = new AllFieldTypes();
        AllFieldTypes pc2 = new AllFieldTypes();
        AllFieldTypes pc3 = new AllFieldTypes();
        AllFieldTypes pc4 = new AllFieldTypes();

        // pc1 and pc2, pc3 and pc4 grouped on intField, shortField
        pc1.setIntField(1);
        pc1.setShortField((short) -1);
        pc2.setIntField(1);
        pc2.setShortField((short) -1);
        pc3.setIntField(2);
        pc3.setShortField((short) -2);
        pc4.setIntField(2);
        pc4.setShortField((short) -2);

        // pc1 and pc2 grouped on stringField
        pc1.setStringField("abc");
        pc2.setStringField("acd");
        pc3.setStringField("def");
        pc4.setStringField("efg");

        // pc2 and pc3 grouped on byteField
        pc2.setByteField((byte) 1);
        pc3.setByteField((byte) 1);
        pc1.setByteField((byte) 0);
        pc4.setByteField((byte) 2);

        // longField is unique id
        pc1.setLongField(1L);
        pc2.setLongField(2L);
        pc3.setLongField(3L);
        pc4.setLongField(4L);

        // set up some relations
        pc1.setSelfOneOne(pc4);
        pc2.setSelfOneOne(pc3);
        pc3.setSelfOneOne(pc2);
        pc4.setSelfOneOne(pc1);

        // if variable testing, set up some 1-Ms instead of the 1-1s above
        if (getName().startsWith("testVariable")) {
            pc1.setSelfOneOne(pc1);
            pc2.setSelfOneOne(pc1);
            pc1.getSelfOneMany().add(pc1);
            pc1.getSelfOneMany().add(pc2);

            pc3.setSelfOneOne(pc3);
            pc4.setSelfOneOne(pc3);
            pc3.getSelfOneMany().add(pc3);
            pc3.getSelfOneMany().add(pc4);
        }

        EntityManager em = emf.createEntityManager();
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

    extends SingleEMFTestCase {

    public void setUp() {
        setUp(AllFieldTypes.class, CLEAR_TABLES);

        AllFieldTypes aft = new AllFieldTypes();
        aft.setStringField("foo'bar");
        AllFieldTypes aft2 = new AllFieldTypes();
        aft2.setStringField("foo-bar");
        AllFieldTypes aft3 = new AllFieldTypes();
        aft3.setStringField("foo\"bar");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(aft);
        em.persist(aft2);
        em.persist(aft3);
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

            public void beforePersist(LifecycleEvent event) {
                ((AllFieldTypes) event.getSource()).setLongField(17);
            }
        }, (Class[]) null);

        AllFieldTypes aft = new AllFieldTypes();
        aft.setStringField("foo");
        aft.setIntField(5);

        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(aft);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        aft = (AllFieldTypes) em.createQuery("select o from AllFieldTypes o")
            .getSingleResult();
        // is changed in the listener impl
        assertEquals(17, aft.getLongField());
        em.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

        beginCount = 0;
        persistCount = 0;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            em.persist(new AllFieldTypes());
            em.flush();
            assertEquals(1, beginCount);
            assertEquals(1, persistCount);
        } finally {
            em.getTransaction().rollback();
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

      OpenJPAEntityManagerSPI em = emf.createEntityManager();    
        try {
          DBDictionary dict = ((JDBCConfiguration) em.getConfiguration())
                    .getDBDictionaryInstance();
           if (dict instanceof DB2Dictionary) {
             AllFieldTypes allFieldTypes = new AllFieldTypes();
              allFieldTypes.setStringField("testString");
              allFieldTypes.setIntField(2012);
             
              em.getTransaction().begin();
              em.persist(allFieldTypes);
              Query query = em.createQuery("select e from AllFieldTypes e where e.stringField = ?1");
              query.setParameter(1, "testString");
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

    public void setUp() {
        super.setUp(AllFieldTypes.class, CLEAR_TABLES,
            "openjpa.Compatibility", "JPQL=warn");

        AllFieldTypes pc1 = new AllFieldTypes();
        AllFieldTypes pc2 = new AllFieldTypes();
        AllFieldTypes pc3 = new AllFieldTypes();
        AllFieldTypes pc4 = new AllFieldTypes();

        // pc1 and pc2, pc3 and pc4 grouped on intField, shortField
        pc1.setIntField(1);
        pc1.setShortField((short) -1);
        pc2.setIntField(1);
        pc2.setShortField((short) -1);
        pc3.setIntField(2);
        pc3.setShortField((short) -2);
        pc4.setIntField(2);
        pc4.setShortField((short) -2);

        // pc1 and pc2 grouped on stringField
        pc1.setStringField("abc");
        pc2.setStringField("acd");
        pc3.setStringField("def");
        pc4.setStringField("efg");

        // pc2 and pc3 grouped on byteField
        pc2.setByteField((byte) 1);
        pc3.setByteField((byte) 1);
        pc1.setByteField((byte) 0);
        pc4.setByteField((byte) 2);

        // longField is unique id
        pc1.setLongField(1L);
        pc2.setLongField(2L);
        pc3.setLongField(3L);
        pc4.setLongField(4L);

        // set up some relations
        pc1.setSelfOneOne(pc4);
        pc2.setSelfOneOne(pc3);
        pc3.setSelfOneOne(pc2);
        pc4.setSelfOneOne(pc1);

        // if variable testing, set up some 1-Ms instead of the 1-1s above
        if (getName().startsWith("testVariable")) {
            pc1.setSelfOneOne(pc1);
            pc2.setSelfOneOne(pc1);
            pc1.getSelfOneMany().add(pc1);
            pc1.getSelfOneMany().add(pc2);

            pc3.setSelfOneOne(pc3);
            pc4.setSelfOneOne(pc3);
            pc3.getSelfOneMany().add(pc3);
            pc3.getSelfOneMany().add(pc4);
        }

        EntityManager em = emf.createEntityManager();
View Full Code Here

Examples of org.apache.openjpa.persistence.simple.AllFieldTypes

    extends SingleEMFTestCase {

    public void setUp() {
        setUp(AllFieldTypes.class, CLEAR_TABLES);

        AllFieldTypes aft = new AllFieldTypes();
        aft.setStringField("foo'bar");
        AllFieldTypes aft2 = new AllFieldTypes();
        aft2.setStringField("foo-bar");
        AllFieldTypes aft3 = new AllFieldTypes();
        aft3.setStringField("foo\"bar");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(aft);
        em.persist(aft2);
        em.persist(aft3);
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.