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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations