Package com.impetus.client.crud.datatypes.entities

Examples of com.impetus.client.crud.datatypes.entities.StudentMongoLongPrimitive


    public void testPersist(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();

        // Insert max value of long
        StudentMongoLongPrimitive studentMax = new StudentMongoLongPrimitive();
        studentMax.setAge((Short) getMaxValue(short.class));
        studentMax.setId((Long) getMaxValue(long.class));
        studentMax.setName((String) getMaxValue(String.class));
        em.persist(studentMax);

        // Insert min value of long
        StudentMongoLongPrimitive studentMin = new StudentMongoLongPrimitive();
        studentMin.setAge((Short) getMinValue(short.class));
        studentMin.setId((Long) getMinValue(long.class));
        studentMin.setName((String) getMinValue(String.class));
        em.persist(studentMin);

        // Insert random value of long
        StudentMongoLongPrimitive student = new StudentMongoLongPrimitive();
        student.setAge((Short) getRandomValue(short.class));
        student.setId((Long) getRandomValue(long.class));
        student.setName((String) getRandomValue(String.class));
        em.persist(student);
        em.close();
    }
View Full Code Here


    public void testFindById(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();

        StudentMongoLongPrimitive studentMax = em.find(StudentMongoLongPrimitive.class, getMaxValue(long.class));
        Assert.assertNotNull(studentMax);
        Assert.assertEquals(getMaxValue(short.class), studentMax.getAge());
        Assert.assertEquals(getMaxValue(String.class), studentMax.getName());

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoLongPrimitive studentMin = em.find(StudentMongoLongPrimitive.class, getMinValue(long.class));
        Assert.assertNotNull(studentMin);
        Assert.assertEquals(getMinValue(short.class), studentMin.getAge());
        Assert.assertEquals(getMinValue(String.class), studentMin.getName());

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoLongPrimitive student = em.find(StudentMongoLongPrimitive.class, getRandomValue(long.class));
        Assert.assertNotNull(student);
        Assert.assertEquals(getRandomValue(short.class), student.getAge());
        Assert.assertEquals(getRandomValue(String.class), student.getName());
        em.close();
    }
View Full Code Here

    }

    public void testMerge(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();
        StudentMongoLongPrimitive student = em.find(StudentMongoLongPrimitive.class, getMaxValue(long.class));
        Assert.assertNotNull(student);
        Assert.assertEquals(getMaxValue(short.class), student.getAge());
        Assert.assertEquals(getMaxValue(String.class), student.getName());

        student.setName("Kuldeep");
        em.merge(student);
        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoLongPrimitive newStudent = em.find(StudentMongoLongPrimitive.class, getMaxValue(long.class));
        Assert.assertNotNull(newStudent);
        Assert.assertEquals(getMaxValue(short.class), newStudent.getAge());
        Assert.assertEquals("Kuldeep", newStudent.getName());
    }
View Full Code Here

    public void testDelete(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();

        StudentMongoLongPrimitive studentMax = em.find(StudentMongoLongPrimitive.class, getMaxValue(long.class));
        Assert.assertNotNull(studentMax);
        Assert.assertEquals(getMaxValue(short.class), studentMax.getAge());
        Assert.assertEquals("Kuldeep", studentMax.getName());
        em.remove(studentMax);
        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
View Full Code Here

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoLongPrimitive newStudent = em.find(StudentMongoLongPrimitive.class, getRandomValue(long.class));
        Assert.assertNull(newStudent);
        em.close();
    }
View Full Code Here

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoLongPrimitive newStudent = em.find(StudentMongoLongPrimitive.class, getRandomValue(long.class));
        Assert.assertNotNull(newStudent);
        Assert.assertEquals(getRandomValue(short.class), newStudent.getAge());
        Assert.assertEquals("Vivek", newStudent.getName());
        em.close();
    }
View Full Code Here

TOP

Related Classes of com.impetus.client.crud.datatypes.entities.StudentMongoLongPrimitive

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.