Search in sources :

Example 1 with Oc4jPlatform

use of org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform in project eclipselink by eclipse-ee4j.

the class JUnitJPQLComplexTestSuite method mappedKeyMapContainerPolicyMapKeyInSelectionCriteriaTest.

public void mappedKeyMapContainerPolicyMapKeyInSelectionCriteriaTest() {
    // skip test on OC4j some this test fails on some OC4j versions because of an issue with Timestamp
    if (getServerSession().getServerPlatform() != null && getServerSession().getServerPlatform() instanceof Oc4jPlatform) {
        return;
    }
    EntityManager em = createEntityManager();
    beginTransaction(em);
    try {
        BeerConsumer consumer = new BeerConsumer();
        consumer.setName("Marvin Monroe");
        em.persist(consumer);
        Becks becks = new Becks();
        becks.setAlcoholContent(5.0);
        BecksTag tag = new BecksTag();
        tag.setCallNumber("123");
        consumer.addBecksBeerToConsume(becks, tag);
        em.persist(becks);
        em.persist(tag);
        BeerConsumer consumer2 = new BeerConsumer();
        consumer.setName("Marvin Monroe2");
        em.persist(consumer2);
        Becks becks2 = new Becks();
        becks2.setAlcoholContent(5.0);
        BecksTag tag2 = new BecksTag();
        tag2.setCallNumber("1234");
        consumer2.addBecksBeerToConsume(becks2, tag2);
        em.persist(becks2);
        em.persist(tag2);
        em.flush();
        Vector expectedResult = new Vector();
        expectedResult.add(consumer);
        clearCache();
        String ejbqlString = "SELECT bc FROM BeerConsumer bc join bc.becksBeersToConsume b where Key(b).callNumber = '123'";
        List result = em.createQuery(ejbqlString).getResultList();
        Assert.assertTrue("mappedKeyMapContainerPolicyMapKeyInSelectionCriteriaTest failed", comparer.compareObjects(result, expectedResult));
    } finally {
        rollbackTransaction(em);
        closeEntityManager(em);
    }
}
Also used : EntityManager(jakarta.persistence.EntityManager) JpaEntityManager(org.eclipse.persistence.jpa.JpaEntityManager) Oc4jPlatform(org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform) Becks(org.eclipse.persistence.testing.models.jpa.inherited.Becks) List(java.util.List) ArrayList(java.util.ArrayList) ExpertBeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.ExpertBeerConsumer) BeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.BeerConsumer) Vector(java.util.Vector) BecksTag(org.eclipse.persistence.testing.models.jpa.inherited.BecksTag)

Example 2 with Oc4jPlatform

use of org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform in project eclipselink by eclipse-ee4j.

the class JUnitJPQLComplexTestSuite method mapContainerPolicyMapValueInSelectionCriteriaTest.

public void mapContainerPolicyMapValueInSelectionCriteriaTest() {
    // skip test on OC4j some this test fails on some OC4j versions because of an issue with Timestamp
    if (getServerSession().getServerPlatform() != null && getServerSession().getServerPlatform() instanceof Oc4jPlatform) {
        return;
    }
    EntityManager em = createEntityManager();
    beginTransaction(em);
    try {
        BeerConsumer consumer = new BeerConsumer();
        consumer.setName("Marvin Monroe");
        em.persist(consumer);
        Blue blue = new Blue();
        blue.setAlcoholContent(5.0f);
        blue.setUniqueKey(BigInteger.ONE);
        consumer.addBlueBeerToConsume(blue);
        em.persist(blue);
        BeerConsumer consumer2 = new BeerConsumer();
        consumer2.setName("Marvin Monroe2");
        em.persist(consumer2);
        Blue blue2 = new Blue();
        blue2.setAlcoholContent(5.0f);
        blue2.setUniqueKey(BigInteger.valueOf(2));
        consumer2.addBlueBeerToConsume(blue2);
        em.persist(blue2);
        em.flush();
        Vector expectedResult = new Vector();
        expectedResult.add(consumer);
        clearCache();
        String ejbqlString = "SELECT bc FROM BeerConsumer bc join bc.blueBeersToConsume b where VALUE(b).uniqueKey = 1";
        List result = em.createQuery(ejbqlString).getResultList();
        Assert.assertTrue("mapContainerPolicyMapValueInSelectionCriteriaTest failed", comparer.compareObjects(result, expectedResult));
    } finally {
        rollbackTransaction(em);
        closeEntityManager(em);
    }
}
Also used : EntityManager(jakarta.persistence.EntityManager) JpaEntityManager(org.eclipse.persistence.jpa.JpaEntityManager) Blue(org.eclipse.persistence.testing.models.jpa.inherited.Blue) Oc4jPlatform(org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform) List(java.util.List) ArrayList(java.util.ArrayList) ExpertBeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.ExpertBeerConsumer) BeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.BeerConsumer) Vector(java.util.Vector)

Example 3 with Oc4jPlatform

use of org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform in project eclipselink by eclipse-ee4j.

the class JUnitJPQLComplexTestSuite method mappedContainerPolicyCompoundMapKeyTest.

public void mappedContainerPolicyCompoundMapKeyTest() {
    // skip test on OC4j some this test fails on some OC4j versions because of an issue with Timestamp
    if (getServerSession().getServerPlatform() != null && getServerSession().getServerPlatform() instanceof Oc4jPlatform) {
        return;
    }
    EntityManager em = createEntityManager();
    beginTransaction(em);
    try {
        BeerConsumer consumer = new BeerConsumer();
        consumer.setName("Marvin Monroe");
        em.persist(consumer);
        TelephoneNumber number = new TelephoneNumber();
        number.setType("Home");
        number.setAreaCode("975");
        number.setNumber("1234567");
        em.persist(number);
        consumer.addTelephoneNumber(number);
        BeerConsumer consumer2 = new BeerConsumer();
        consumer2.setName("Marvin Monroe2");
        em.persist(consumer2);
        TelephoneNumber number2 = new TelephoneNumber();
        number2.setType("Home");
        number2.setAreaCode("974");
        number2.setNumber("1234567");
        em.persist(number2);
        consumer2.addTelephoneNumber(number2);
        em.flush();
        Vector expectedResult = new Vector();
        expectedResult.add(number);
        clearCache();
        String ejbqlString = "SELECT KEY(number) from BeerConsumer bc join bc.telephoneNumbers number where bc.name = 'Marvin Monroe'";
        List result = em.createQuery(ejbqlString).getResultList();
        Assert.assertTrue("mappedContainerPolicyCompoundMapKeyTest failed", comparer.compareObjects(result, expectedResult));
    } finally {
        rollbackTransaction(em);
        closeEntityManager(em);
    }
}
Also used : EntityManager(jakarta.persistence.EntityManager) JpaEntityManager(org.eclipse.persistence.jpa.JpaEntityManager) Oc4jPlatform(org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform) List(java.util.List) ArrayList(java.util.ArrayList) ExpertBeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.ExpertBeerConsumer) BeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.BeerConsumer) TelephoneNumber(org.eclipse.persistence.testing.models.jpa.inherited.TelephoneNumber) Vector(java.util.Vector)

Example 4 with Oc4jPlatform

use of org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform in project eclipselink by eclipse-ee4j.

the class JUnitJPQLComplexTestSuite method mappedKeyMapContainerPolicyNavigateMapKeyInEmbeddableTest.

public void mappedKeyMapContainerPolicyNavigateMapKeyInEmbeddableTest() {
    // skip test on OC4j some this test fails on some OC4j versions because of an issue with Timestamp
    if (getServerSession().getServerPlatform() != null && getServerSession().getServerPlatform() instanceof Oc4jPlatform) {
        return;
    }
    EntityManager em = createEntityManager();
    beginTransaction(em);
    try {
        BeerConsumer consumer = new BeerConsumer();
        consumer.setName("Marvin Monroe");
        em.persist(consumer);
        Corona corona = new Corona();
        corona.setAlcoholContent(5.0);
        CoronaTag tag = new CoronaTag();
        tag.setCode("123");
        tag.setNumber(123);
        consumer.addCoronaBeerToConsume(corona, tag);
        em.persist(corona);
        BeerConsumer consumer2 = new BeerConsumer();
        consumer2.setName("Marvin Monroe2");
        em.persist(consumer2);
        Corona corona2 = new Corona();
        corona2.setAlcoholContent(5.0);
        CoronaTag tag2 = new CoronaTag();
        tag2.setCode("1234");
        tag2.setNumber(1234);
        consumer2.addCoronaBeerToConsume(corona2, tag2);
        em.persist(corona2);
        em.flush();
        Vector expectedResult = new Vector();
        expectedResult.add("123");
        clearCache();
        String ejbqlString = "SELECT KEY(c).code from BeerConsumer bc join bc.coronaBeersToConsume c where bc.name = 'Marvin Monroe'";
        List result = em.createQuery(ejbqlString).getResultList();
        Assert.assertTrue("mappedKeyMapContainerPolicyNavigateMapKeyInEmbeddableTest failed", comparer.compareObjects(result, expectedResult));
    } finally {
        rollbackTransaction(em);
        closeEntityManager(em);
    }
}
Also used : EntityManager(jakarta.persistence.EntityManager) JpaEntityManager(org.eclipse.persistence.jpa.JpaEntityManager) Oc4jPlatform(org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform) CoronaTag(org.eclipse.persistence.testing.models.jpa.inherited.CoronaTag) Corona(org.eclipse.persistence.testing.models.jpa.inherited.Corona) List(java.util.List) ArrayList(java.util.ArrayList) ExpertBeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.ExpertBeerConsumer) BeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.BeerConsumer) Vector(java.util.Vector)

Example 5 with Oc4jPlatform

use of org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform in project eclipselink by eclipse-ee4j.

the class JUnitJPQLComplexTestSuite method mappedKeyMapContainerPolicyElementCollectionSelectionCriteriaTest.

public void mappedKeyMapContainerPolicyElementCollectionSelectionCriteriaTest() {
    // skip test on OC4j some this test fails on some OC4j versions because of an issue with Timestamp
    if (getServerSession().getServerPlatform() != null && getServerSession().getServerPlatform() instanceof Oc4jPlatform) {
        return;
    }
    EntityManager em = createEntityManager();
    beginTransaction(em);
    try {
        ExpertBeerConsumer consumer = new ExpertBeerConsumer();
        consumer.setAccredidation(new Accredidation());
        consumer.setName("Marvin Monroe");
        Birthday bday = new Birthday();
        bday.setDay(25);
        bday.setMonth(6);
        bday.setYear(2009);
        consumer.addCelebration(bday, "Lots of Cake!");
        ExpertBeerConsumer consumer2 = new ExpertBeerConsumer();
        consumer2.setAccredidation(new Accredidation());
        consumer2.setName("Marvin Monroe2");
        Birthday bday2 = new Birthday();
        bday2.setDay(25);
        bday2.setMonth(6);
        bday2.setYear(2001);
        consumer2.addCelebration(bday, "Lots of food!");
        em.persist(consumer);
        em.flush();
        Vector expectedResult = new Vector();
        expectedResult.add(consumer);
        clearCache();
        String ejbqlString = "SELECT bc FROM EXPERT_CONSUMER bc join bc.celebrations c where Key(c).day = :celebration";
        List result = em.createQuery(ejbqlString).setParameter("celebration", 25).getResultList();
        Assert.assertTrue("mappedKeyMapContainerPolicyElementCollctionSelectionCriteriaTest failed", comparer.compareObjects(result, expectedResult));
    } finally {
        rollbackTransaction(em);
        closeEntityManager(em);
    }
}
Also used : EntityManager(jakarta.persistence.EntityManager) JpaEntityManager(org.eclipse.persistence.jpa.JpaEntityManager) ExpertBeerConsumer(org.eclipse.persistence.testing.models.jpa.inherited.ExpertBeerConsumer) Oc4jPlatform(org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform) Accredidation(org.eclipse.persistence.testing.models.jpa.inherited.Accredidation) Birthday(org.eclipse.persistence.testing.models.jpa.inherited.Birthday) List(java.util.List) ArrayList(java.util.ArrayList) Vector(java.util.Vector)

Aggregations

EntityManager (jakarta.persistence.EntityManager)13 ArrayList (java.util.ArrayList)13 List (java.util.List)13 JpaEntityManager (org.eclipse.persistence.jpa.JpaEntityManager)13 Oc4jPlatform (org.eclipse.persistence.platform.server.oc4j.Oc4jPlatform)13 ExpertBeerConsumer (org.eclipse.persistence.testing.models.jpa.inherited.ExpertBeerConsumer)13 BeerConsumer (org.eclipse.persistence.testing.models.jpa.inherited.BeerConsumer)12 Vector (java.util.Vector)11 Blue (org.eclipse.persistence.testing.models.jpa.inherited.Blue)5 Becks (org.eclipse.persistence.testing.models.jpa.inherited.Becks)4 BecksTag (org.eclipse.persistence.testing.models.jpa.inherited.BecksTag)4 Map (java.util.Map)2 Corona (org.eclipse.persistence.testing.models.jpa.inherited.Corona)2 CoronaTag (org.eclipse.persistence.testing.models.jpa.inherited.CoronaTag)2 Accredidation (org.eclipse.persistence.testing.models.jpa.inherited.Accredidation)1 Birthday (org.eclipse.persistence.testing.models.jpa.inherited.Birthday)1 TelephoneNumber (org.eclipse.persistence.testing.models.jpa.inherited.TelephoneNumber)1