mirror of https://github.com/apache/openjpa.git
OPENJPA-1015. Enforce column width for testcases
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@779361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fcebb24e61
commit
3464d8e9b8
|
@ -52,9 +52,10 @@ public class XMLDefPropMixedFieldAccess2 {
|
|||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof XMLDefPropMixedFieldAccess2) {
|
||||
XMLDefPropMixedFieldAccess2 dpmfa = (XMLDefPropMixedFieldAccess2)obj;
|
||||
return getId() == dpmfa.getId() &&
|
||||
getStrField().equals(dpmfa.getStrProp());
|
||||
XMLDefPropMixedFieldAccess2 dpmfa =
|
||||
(XMLDefPropMixedFieldAccess2) obj;
|
||||
return getId() == dpmfa.getId()
|
||||
&& getStrField().equals(dpmfa.getStrProp());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,14 @@ package org.apache.openjpa.persistence.criteria;
|
|||
import javax.persistence.metamodel.Attribute;
|
||||
import javax.persistence.metamodel.List;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.criteria.CompUser.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.criteria.CompUser.class)
|
||||
public class CompUser_ {
|
||||
public static volatile Attribute<CompUser,Address> address;
|
||||
public static volatile Attribute<CompUser,Integer> age;
|
||||
public static volatile Attribute<CompUser,String> computerName;
|
||||
public static volatile Attribute<CompUser,CompUser.CreditRating> creditRating;
|
||||
public static volatile Attribute<CompUser,
|
||||
CompUser.CreditRating> creditRating;
|
||||
public static volatile Attribute<CompUser,String> name;
|
||||
public static volatile List<CompUser,String> nicknames;
|
||||
public static volatile Attribute<CompUser,Integer> userid;
|
||||
|
|
|
@ -50,7 +50,8 @@ public class CreditCard {
|
|||
return transactionHistory;
|
||||
}
|
||||
|
||||
public void setTransactionHistory(List<TransactionHistory> transactionHistory) {
|
||||
public void setTransactionHistory(List<TransactionHistory>
|
||||
transactionHistory) {
|
||||
this.transactionHistory = transactionHistory;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,5 +22,6 @@ public class Customer_ {
|
|||
public static volatile Attribute<Customer,String> name;
|
||||
public static volatile Set<Customer,Order> orders;
|
||||
public static volatile Attribute<Customer,Integer> status;
|
||||
public static volatile Attribute<Customer,Customer.CreditRating> creditRating;
|
||||
public static volatile Attribute<Customer,Customer.CreditRating>
|
||||
creditRating;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ public class Employee_ {
|
|||
public static volatile Attribute<Employee,Contact> contactInfo;
|
||||
public static volatile Attribute<Employee,Department> department;
|
||||
public static volatile Attribute<Employee,Integer> empId;
|
||||
public static volatile Attribute<Employee,FrequentFlierPlan> frequentFlierPlan;
|
||||
public static volatile Attribute<Employee,FrequentFlierPlan>
|
||||
frequentFlierPlan;
|
||||
public static volatile Attribute<Employee,Manager> manager;
|
||||
public static volatile Attribute<Employee,String> name;
|
||||
public static volatile Attribute<Employee,Integer> rating;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.apache.openjpa.persistence.criteria;
|
||||
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.criteria.FemaleUser.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.criteria.FemaleUser.class)
|
||||
public class FemaleUser_ extends CompUser_ {
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ package org.apache.openjpa.persistence.criteria;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.criteria.FrequentFlierPlan.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.criteria.FrequentFlierPlan.class)
|
||||
public class FrequentFlierPlan_ {
|
||||
public static volatile Attribute<FrequentFlierPlan,Integer> annualMiles;
|
||||
public static volatile Attribute<FrequentFlierPlan,String> id;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.apache.openjpa.persistence.criteria;
|
||||
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.criteria.MaleUser.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.criteria.MaleUser.class)
|
||||
public class MaleUser_ extends CompUser_ {
|
||||
}
|
||||
|
|
|
@ -163,8 +163,11 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
DomainObject c = qb.createQueryDefinition(Customer.class);
|
||||
DomainObject o = c.join("orders");
|
||||
DomainObject a = c.join("address");
|
||||
o.where(a.get("state").equal("CA").and(a.get("county").equal("Santa Clara")));
|
||||
o.select(o.get("quantity"), o.get("cost").times(1.08), a.get("zipCode"));
|
||||
o.where(a.get("state").equal("CA").and(
|
||||
a.get("county").equal("Santa Clara")));
|
||||
o
|
||||
.select(o.get("quantity"), o.get("cost").times(1.08), a
|
||||
.get("zipCode"));
|
||||
|
||||
String jpql = "select o.quantity, o.cost*1.08, a.zipCode" +
|
||||
" from Customer c join c.orders o join c.address a" +
|
||||
|
@ -199,8 +202,8 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
DomainObject o = qb.createQueryDefinition(Order.class);
|
||||
DomainObject l = o.join("lineItems");
|
||||
DomainObject c = o.join("customer");
|
||||
c.where(c.get("lastName").equal("Smith").and(c.get("firstName").equal("John")))
|
||||
.select(l.get("price").sum());
|
||||
c.where(c.get("lastName").equal("Smith").and(c.get("firstName").
|
||||
equal("John"))).select(l.get("price").sum());
|
||||
|
||||
String jpql = "select SUM(l.price)" +
|
||||
" from Order o join o.lineItems l JOIN o.customer c" +
|
||||
|
@ -310,10 +313,10 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
order.get("count")));
|
||||
|
||||
|
||||
String jpql = "SELECT NEW org.apache.openjpa.persistence.criteria.Customer"
|
||||
String jpql =
|
||||
"SELECT NEW org.apache.openjpa.persistence.criteria.Customer"
|
||||
+ "(c.id, c.status, o.count)"
|
||||
+ " FROM Customer c JOIN c.orders o"
|
||||
+ " WHERE o.count > 100";
|
||||
+ " FROM Customer c JOIN c.orders o" + " WHERE o.count > 100";
|
||||
compare(jpql, q);
|
||||
}
|
||||
|
||||
|
@ -321,9 +324,10 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
QueryDefinition q = qb.createQueryDefinition();
|
||||
DomainObject v = q.addRoot(VideoStore.class);
|
||||
DomainObject i = v.join("videoInventory");
|
||||
q.where(v.get("location").get("zipCode").equal("94301")
|
||||
.and(i.value().greaterThan(0)));
|
||||
q.select(v.get("location").get("street"), i.key().get("title"), i.value());
|
||||
q.where(v.get("location").get("zipCode").equal("94301").and(
|
||||
i.value().greaterThan(0)));
|
||||
q.select(v.get("location").get("street"), i.key().get("title"), i
|
||||
.value());
|
||||
|
||||
String jpql = "SELECT v.location.street, KEY(v2).title, VALUE(v2)"
|
||||
+ " FROM VideoStore v JOIN v.videoInventory v2"
|
||||
|
@ -431,7 +435,8 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
|
||||
public void testCreateSubquery() {
|
||||
DomainObject customer = qb.createQueryDefinition(Customer.class);
|
||||
DomainObject order = qb.createSubqueryDefinition(customer.get("orders"));
|
||||
DomainObject order =
|
||||
qb.createSubqueryDefinition(customer.get("orders"));
|
||||
customer.where(order.select(order.get("cost").avg()).greaterThan(100));
|
||||
|
||||
String jpql = "SELECT c "
|
||||
|
@ -466,10 +471,11 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
DomainObject e = qb.createQueryDefinition(Employee.class);
|
||||
DomainObject f = e.join("frequentFlierPlan");
|
||||
Expression c =
|
||||
e.generalCase().when(f.get("annualMiles").greaterThan(50000)).then("Platinum")
|
||||
.when(f.get("annualMiles").greaterThan(25000)).then("Gold")
|
||||
.elseCase("XYZ");
|
||||
e.select(e.get("name"), f.get("name"), e.concat(c,e.literal("Frequent Flyer")));
|
||||
e.generalCase().when(f.get("annualMiles").greaterThan(50000)).then(
|
||||
"Platinum").when(f.get("annualMiles").greaterThan(25000)).then(
|
||||
"Gold").elseCase("XYZ");
|
||||
e.select(e.get("name"), f.get("name"), e.concat(c, e
|
||||
.literal("Frequent Flyer")));
|
||||
|
||||
String jpql = "SELECT e.name, f.name, CONCAT("
|
||||
+ " CASE WHEN f.annualMiles > 50000 THEN 'Platinum'"
|
||||
|
@ -482,13 +488,15 @@ public class TestCriteria extends SingleEMFTestCase {
|
|||
|
||||
public void testCorrelatedSubquerySpecialCase1() {
|
||||
DomainObject o = qb.createQueryDefinition(Order.class);
|
||||
DomainObject a = qb.createSubqueryDefinition(o.get("customer").get("accounts"));
|
||||
DomainObject a = qb.createSubqueryDefinition(o.get("customer").
|
||||
get("accounts"));
|
||||
o.select(o)
|
||||
.where(o.literal(10000).lessThan(a.select(a.get("balance")).all()));
|
||||
|
||||
String jpql = "select o from Order o"
|
||||
+ " where 10000 < ALL "
|
||||
+ " (select a.balance from o.customer c join o.customer.accounts a)";
|
||||
String jpql =
|
||||
"select o from Order o" + " where 10000 < ALL "
|
||||
+ " (select a.balance from o.customer c "
|
||||
+ "join o.customer.accounts a)";
|
||||
|
||||
compare(jpql, o);
|
||||
}
|
||||
|
|
|
@ -153,8 +153,9 @@ public class TestMetaModelTypesafeCriteria extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testFetchJoins() {
|
||||
String jpql = "SELECT d FROM Department LEFT JOIN FETCH d.employees " +
|
||||
"WHERE d.deptNo = 1";
|
||||
String jpql =
|
||||
"SELECT d FROM Department LEFT JOIN FETCH d.employees "
|
||||
+ "WHERE d.deptNo = 1";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Department> d = q.from(Department.class);
|
||||
d.fetch(department_.getSet("employees", Employee.class), JoinType.LEFT);
|
||||
|
@ -174,10 +175,10 @@ public class TestMetaModelTypesafeCriteria extends CriteriaTest {
|
|||
Join<Contact, Phone> phone = emp.join(
|
||||
employee_.getAttribute("contactInfo", Contact.class)).
|
||||
join(contact_.getList("phones", Phone.class));
|
||||
q.where(cb.equal(emp.get(employee_.getAttribute("contactInfo",
|
||||
Contact.class)).
|
||||
get(contact_.getAttribute("address", Address.class)).
|
||||
get(address_.getAttribute("zipCode", String.class)), "95054"));
|
||||
q.where(cb.equal(emp.get(
|
||||
employee_.getAttribute("contactInfo", Contact.class)).get(
|
||||
contact_.getAttribute("address", Address.class)).get(
|
||||
address_.getAttribute("zipCode", String.class)), "95054"));
|
||||
q.select(phone.get(phone_.getAttribute("vendor", String.class)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
|
@ -348,9 +349,10 @@ public class TestMetaModelTypesafeCriteria extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testSelectList() {
|
||||
String jpql = "SELECT v.location.street, KEY(i).title, VALUE(i) FROM " +
|
||||
"VideoStore v JOIN v.videoInventory i WHERE v.location.zipCode = " +
|
||||
"'94301' AND VALUE(i) > 0";
|
||||
String jpql =
|
||||
"SELECT v.location.street, KEY(i).title, VALUE(i) FROM "
|
||||
+ "VideoStore v JOIN v.videoInventory i "
|
||||
+ "WHERE v.location.zipCode = " + "'94301' AND VALUE(i) > 0";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<VideoStore> v = q.from(VideoStore.class);
|
||||
MapJoin<VideoStore, Movie, Integer> inv = v.join(videoStore_.getMap(
|
||||
|
@ -370,7 +372,8 @@ public class TestMetaModelTypesafeCriteria extends CriteriaTest {
|
|||
"Customer c JOIN c.orders o WHERE o.quantity > 100";
|
||||
q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Join<Customer, Order> o = c.join(customer_.getSet("orders", Order.class));
|
||||
Join<Customer, Order> o =
|
||||
c.join(customer_.getSet("orders", Order.class));
|
||||
q.where(cb.gt(o.get(order_.getAttribute("quantity", Integer.class)),
|
||||
100));
|
||||
q.select(cb.select(CustomerDetails.class,
|
||||
|
@ -413,8 +416,10 @@ public class TestMetaModelTypesafeCriteria extends CriteriaTest {
|
|||
|
||||
assertEquivalence(q, jpql);
|
||||
|
||||
jpql = "SELECT emp FROM Employee emp WHERE emp.salary > ALL (" +
|
||||
"SELECT m.salary FROM Manager m WHERE m.department = emp.department)";
|
||||
jpql =
|
||||
"SELECT emp FROM Employee emp WHERE emp.salary > ALL ("
|
||||
+ "SELECT m.salary FROM Manager m WHERE m.department ="
|
||||
+ " emp.department)";
|
||||
q = cb.create();
|
||||
Root<Employee> emp1 = q.from(Employee.class);
|
||||
q.select(emp1);
|
||||
|
|
|
@ -297,7 +297,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
CriteriaQuery q = cb.create();
|
||||
Root<CompUser> c = q.from(CompUser.class);
|
||||
Parameter<String> param = cb.parameter(String.class);
|
||||
q.where(cb.equal(c.get(CompUser_.address).get(Address_.country), null));
|
||||
q.where(cb.equal(c.get(CompUser_.address).get(Address_.country),
|
||||
null));
|
||||
q.select(c.get(CompUser_.name));
|
||||
assertEquivalence(q, query);
|
||||
List result = em.createQuery(q).getResultList();
|
||||
|
@ -534,7 +535,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testTrimFunc1() {
|
||||
String query = "select Trim(e.computerName) From CompUser e WHERE e.name='Shannon '";
|
||||
String query = "select Trim(e.computerName) From CompUser e " +
|
||||
"WHERE e.name='Shannon '";
|
||||
CriteriaQuery q = cb.create();
|
||||
q = cb.create();
|
||||
Root<CompUser> e = q.from(CompUser.class);
|
||||
|
@ -572,7 +574,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testLowerFunc2() {
|
||||
String query = "select e.age From CompUser e where LOWER(e.name) ='ugo'";
|
||||
String query = "select e.age From CompUser e where LOWER(e.name)" +
|
||||
" ='ugo'";
|
||||
CriteriaQuery q = cb.create();
|
||||
q = cb.create();
|
||||
Root<CompUser> e = q.from(CompUser.class);
|
||||
|
@ -815,7 +818,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
// can not do TYPE with parameter in the IN clause
|
||||
@AllowFailure
|
||||
public void testTypeExpression1() {
|
||||
String query = "SELECT e FROM CompUser e where TYPE(e) in (?1, ?2) ORDER By e.name";
|
||||
String query = "SELECT e FROM CompUser e where TYPE(e) in (?1, ?2) " +
|
||||
"ORDER By e.name";
|
||||
CriteriaQuery q = cb.create();
|
||||
q = cb.create();
|
||||
Root<CompUser> e = q.from(CompUser.class);
|
||||
|
@ -883,7 +887,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testTypeExpression6() {
|
||||
String query = "SELECT e FROM CompUser e where TYPE(e) not in (MaleUser, FemaleUser)";
|
||||
String query = "SELECT e FROM CompUser e where TYPE(e) not in " +
|
||||
"(MaleUser, FemaleUser)";
|
||||
CriteriaQuery q = cb.create();
|
||||
q = cb.create();
|
||||
Root<CompUser> e = q.from(CompUser.class);
|
||||
|
@ -1115,11 +1120,14 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
public void testGeneralCaseExpression3() {
|
||||
String query = " select e.name, "
|
||||
+ "CASE WHEN e.age = 11 THEN "
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$CreditRating.POOR"
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$" +
|
||||
"CreditRating.POOR"
|
||||
+ " WHEN e.age = 35 THEN "
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$CreditRating.GOOD"
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$" +
|
||||
"CreditRating.GOOD"
|
||||
+ " ELSE "
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$CreditRating.EXCELLENT"
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$" +
|
||||
"CreditRating.EXCELLENT"
|
||||
+ " END FROM CompUser e ORDER BY e.age";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<CompUser> e = q.from(CompUser.class);
|
||||
|
@ -1145,11 +1153,14 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
+ "where e.creditRating = "
|
||||
+ "(select "
|
||||
+ "CASE WHEN e1.age = 11 THEN "
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$CreditRating.POOR"
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$" +
|
||||
"CreditRating.POOR"
|
||||
+ " WHEN e1.age = 35 THEN "
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$CreditRating.GOOD"
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$" +
|
||||
"CreditRating.GOOD"
|
||||
+ " ELSE "
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$CreditRating.EXCELLENT"
|
||||
+ "org.apache.openjpa.persistence.criteria.CompUser$" +
|
||||
"CreditRating.EXCELLENT"
|
||||
+ " END from CompUser e1"
|
||||
+ " where e.userid = e1.userid) ORDER BY e.age";
|
||||
CriteriaQuery q = cb.create();
|
||||
|
@ -1340,7 +1351,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
@AllowFailure
|
||||
public void testSubquery10() {
|
||||
String query = "select o.id from Order o where o.quantity >"
|
||||
+ " (select sum(o2.quantity) from Customer c, in(c.orders) o2) ";
|
||||
+ " (select sum(o2.quantity) from Customer c, "
|
||||
+ "in(c.orders) o2) ";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
q.select(o.get(Order_.id));
|
||||
|
@ -1358,7 +1370,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
public void testSubquery11() {
|
||||
String query = "select o.id from Order o where o.quantity between"
|
||||
+ " (select avg(o2.quantity) from Customer c, in(c.orders) o2)"
|
||||
+ " and (select min(o2.quantity) from Customer c, in(c.orders) o2)";
|
||||
+ " and (select min(o2.quantity) from Customer c, in(c.orders)"
|
||||
+ " o2)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
q.select(o.get(Order_.id));
|
||||
|
@ -1380,8 +1393,10 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testSubquery12() {
|
||||
String query = "select o.id from Customer c, in(c.orders)o "
|
||||
+ "where o.quantity > (select sum(o2.quantity) from c.orders o2)";
|
||||
String query =
|
||||
"select o.id from Customer c, in(c.orders)o "
|
||||
+ "where o.quantity > (select sum(o2.quantity)"
|
||||
+ " from c.orders o2)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
SetJoin<Customer, Order> o = c.join(Customer_.orders);
|
||||
|
@ -1431,7 +1446,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
Subquery<Integer> sq = q.subquery(Integer.class);
|
||||
Root<Magazine> m2 = sq.from(Magazine.class);
|
||||
q.where(cb.equal(m.get(Magazine_.id), sq.select(cb.max(m2.get(Magazine_.id)))));
|
||||
q.where(cb.equal(m.get(Magazine_.id), sq.select(cb.max(m2
|
||||
.get(Magazine_.id)))));
|
||||
|
||||
Subquery<Integer> sq2 = q.subquery(Integer.class);
|
||||
Root<Magazine> m3 = sq2.from(Magazine.class);
|
||||
|
@ -1439,18 +1455,17 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
sq2.where(cb.equal(m3.get(Magazine_.idPublisher).get(Publisher_.id),
|
||||
p.get(Publisher_.id)));
|
||||
|
||||
sq.where(
|
||||
cb.and(
|
||||
cb.equal(m2.get(Magazine_.idPublisher).get(Publisher_.id), p.get(Publisher_.id)),
|
||||
cb.equal(m2.get(Magazine_.datePublished), sq2.select(cb.max(m3.get(Magazine_.id))))
|
||||
)
|
||||
);
|
||||
sq.where(cb.and(cb.equal(m2.get(Magazine_.idPublisher).get(
|
||||
Publisher_.id), p.get(Publisher_.id)), cb.equal(m2
|
||||
.get(Magazine_.datePublished), sq2.select(cb.max(m3
|
||||
.get(Magazine_.id))))));
|
||||
assertEquivalence(q, query);
|
||||
}
|
||||
|
||||
// outstanding problem subqueries:
|
||||
// "select o from Order o where o.amount > (select count(o) from Order o)",
|
||||
// "select o from Order o where o.amount > (select count(o2) from Order o2)",
|
||||
// "select o from Order o where o.amount > (select count(o2) from Order o2)
|
||||
//",
|
||||
// "select c from Customer c left join c.orders p where not exists"
|
||||
// + " (select o2 from c.orders o2 where o2 = o",
|
||||
|
||||
|
@ -1486,7 +1501,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
public void testSubquery16() {
|
||||
String query = "select o1.oid from Order o1 where o1.quantity > "
|
||||
+ " (select o.quantity*2 from LineItem i, Order o"
|
||||
+ " where i.quantity > 10 and o.quantity > 1000 and i.id = o.id)";
|
||||
+ " where i.quantity > 10 and o.quantity > 1000 and i.id = " +
|
||||
"o.id)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o1 = q.from(Order.class);
|
||||
q.select(o1.get(Order_.id));
|
||||
|
@ -1546,7 +1562,8 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
@AllowFailure
|
||||
public void testSubquery19() {
|
||||
String query = "select o.id from Order o where o.quantity >"
|
||||
+ " (select SQRT(o.quantity) from Order o where o.delivered = true)";
|
||||
+ " (select SQRT(o.quantity) from Order o where o.delivered" +
|
||||
" = true)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
q.select(o.get(Order_.id));
|
||||
|
@ -1584,11 +1601,14 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
String query = "select c from Customer c where c.creditRating ="
|
||||
+ " (select "
|
||||
+ " CASE WHEN o2.quantity > 10 THEN "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$CreditRating.POOR"
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$" +
|
||||
"CreditRating.POOR"
|
||||
+ " WHEN o2.quantity = 10 THEN "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$CreditRating.GOOD "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$" +
|
||||
"CreditRating.GOOD "
|
||||
+ " ELSE "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$CreditRating.EXCELLENT "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$" +
|
||||
"CreditRating.EXCELLENT "
|
||||
+ " END from Order o2"
|
||||
+ " where c.id = o2.customer.id)";
|
||||
CriteriaQuery q = cb.create();
|
||||
|
@ -1597,15 +1617,17 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
Subquery<String> sq = q.subquery(String.class);
|
||||
Root<Order> o2 = sq.from(Order.class);
|
||||
sq.where(cb.equal(c.get(Customer_.id), o2.get(Order_.customer).get(Customer_.id)));
|
||||
sq.where(cb.equal(c.get(Customer_.id), o2.get(Order_.customer).get(
|
||||
Customer_.id)));
|
||||
|
||||
q.where(cb.equal(c.get(Customer_.creditRating),
|
||||
//sq.select(
|
||||
cb.selectCase()
|
||||
.when(cb.gt(o2.get(Order_.quantity), 10), Customer.CreditRating.POOR)
|
||||
.when(cb.equal(o2.get(Order_.quantity), 10), Customer.CreditRating.GOOD)
|
||||
.otherwise(Customer.CreditRating.EXCELLENT)
|
||||
//)
|
||||
cb.selectCase().when(cb.gt(o2.get(Order_.quantity), 10),
|
||||
Customer.CreditRating.POOR).when(
|
||||
cb.equal(o2.get(Order_.quantity), 10),
|
||||
Customer.CreditRating.GOOD).otherwise(
|
||||
Customer.CreditRating.EXCELLENT)
|
||||
// )
|
||||
));
|
||||
assertEquivalence(q, query);
|
||||
}
|
||||
|
@ -1615,14 +1637,17 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
public void testSubquery22() {
|
||||
String query = "select c from Customer c "
|
||||
+ "where c.creditRating = (select COALESCE (c1.creditRating, "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$CreditRating.POOR) "
|
||||
+ "from Customer c1 where c1.name = 'Famzy') order by c.name DESC";
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$" +
|
||||
"CreditRating.POOR) "
|
||||
+ "from Customer c1 where c1.name = 'Famzy') order by c.name " +
|
||||
"DESC";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
q.select(c);
|
||||
q.orderBy(cb.desc(c.get(Customer_.name)));
|
||||
|
||||
Subquery<Customer.CreditRating> sq = q.subquery(Customer.CreditRating.class);
|
||||
Subquery<Customer.CreditRating> sq =
|
||||
q.subquery(Customer.CreditRating.class);
|
||||
Root<Customer> c1 = sq.from(Customer.class);
|
||||
sq.where(cb.equal(c1.get(Customer_.name), "Famzy"));
|
||||
|
||||
|
@ -1634,16 +1659,20 @@ public class TestTypeSafeCondExpression extends CriteriaTest {
|
|||
|
||||
@AllowFailure
|
||||
public void testSubquery23() {
|
||||
String query = "select c from Customer c "
|
||||
String query =
|
||||
"select c from Customer c "
|
||||
+ "where c.creditRating = (select NULLIF (c1.creditRating, "
|
||||
+ "org.apache.openjpa.persistence.criteria.Customer$CreditRating.POOR) "
|
||||
+ "from Customer c1 where c1.name = 'Famzy') order by c.name DESC";
|
||||
+ "org.apache.openjpa.persistence.criteria."
|
||||
+ "Customer$CreditRating.POOR) "
|
||||
+ "from Customer c1 where c1.name = 'Famzy') "
|
||||
+ "order by c.name DESC";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
q.select(c);
|
||||
q.orderBy(cb.desc(c.get(Customer_.name)));
|
||||
|
||||
Subquery<Customer.CreditRating> sq = q.subquery(Customer.CreditRating.class);
|
||||
Subquery<Customer.CreditRating> sq =
|
||||
q.subquery(Customer.CreditRating.class);
|
||||
Root<Customer> c1 = sq.from(Customer.class);
|
||||
sq.where(cb.equal(c1.get(Customer_.name), "Famzy"));
|
||||
|
||||
|
|
|
@ -121,7 +121,8 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
}
|
||||
|
||||
public void testInPredicateWithPath() {
|
||||
String jpql = "select a from Account a where a.owner.name in ('X','Y','Z')";
|
||||
String jpql =
|
||||
"select a from Account a where a.owner.name in ('X','Y','Z')";
|
||||
CriteriaQuery c = cb.create();
|
||||
Root<Account> account = c.from(Account.class);
|
||||
c.where(cb.in(account.get(Account_.owner).get(Person_.name)).value("X")
|
||||
|
@ -130,7 +131,8 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
}
|
||||
|
||||
public void testBinaryPredicate() {
|
||||
String jpql = "select a from Account a where a.balance>100 and a.balance<200";
|
||||
String jpql =
|
||||
"select a from Account a where a.balance>100 and a.balance<200";
|
||||
|
||||
CriteriaQuery c = cb.create();
|
||||
Root<Account> account = c.from(Account.class);
|
||||
|
@ -154,7 +156,8 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
}
|
||||
|
||||
public void testBetweenExpression() {
|
||||
String jpql = "select a from Account a where a.balance between 100 and 200";
|
||||
String jpql =
|
||||
"select a from Account a where a.balance between 100 and 200";
|
||||
|
||||
CriteriaQuery c = cb.create();
|
||||
Root<Account> account = c.from(Account.class);
|
||||
|
@ -238,7 +241,8 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
|
||||
@AllowFailure(message = "Key expression not implemented")
|
||||
public void testKeyExpression() {
|
||||
String jpql = "SELECT i.name, p FROM Item i JOIN i.photos p WHERE KEY(p) "
|
||||
String jpql =
|
||||
"SELECT i.name, p FROM Item i JOIN i.photos p WHERE KEY(p) "
|
||||
+ "LIKE '%egret%'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Item> item = q.from(Item.class);
|
||||
|
@ -274,60 +278,61 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "broken")
|
||||
public void testExpressionInProjection() {
|
||||
String jpql = "SELECT o.quantity, o.totalCost*1.08 AS taxedCost, "
|
||||
+ "a.zipCode FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
+ "WHERE a.state = 'CA' AND a.county = 'Santa Clara'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> cust = q.from(Customer.class);
|
||||
Join<Customer, Order> order = cust.join(Customer_.orders);
|
||||
Join<Customer, Address> address = cust.join(Customer_.address);
|
||||
q.where(cb.equal(address.get(Address_.state), "CA"), cb.equal(address
|
||||
.get(Address_.county), "Santa Clara"));
|
||||
q.select(order.get(Order_.quantity), cb.prod(order
|
||||
.get(Order_.totalCost), 1.08), address.get(Address_.zipCode));
|
||||
// @AllowFailure(message = "broken")
|
||||
// public void testExpressionInProjection() {
|
||||
// String jpql = "SELECT o.quantity, o.totalCost*1.08 AS taxedCost, "
|
||||
// + "a.zipCode FROM Customer c JOIN c.orders o JOIN c.address a"
|
||||
// + "WHERE a.state = 'CA' AND a.county = 'Santa Clara'";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> cust = q.from(Customer.class);
|
||||
// Join<Customer, Order> order = cust.join(Customer_.orders);
|
||||
// Join<Customer, Address> address = cust.join(Customer_.address);
|
||||
// q.where(cb.equal(address.get(Address_.state), "CA"), cb.equal(address
|
||||
// .get(Address_.county), "Santa Clara"));
|
||||
// q.select(order.get(Order_.quantity), cb.prod(order
|
||||
// .get(Order_.totalCost), 1.08), address.get(Address_.zipCode));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
// @AllowFailure(message =
|
||||
// "Type expression was working with Fay. Now refactored and broken")
|
||||
// public void testTypeExpression() {
|
||||
// String jpql = "SELECT TYPE(e) FROM Employee e WHERE TYPE(e) <> Exempt";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Employee> emp = q.from(Employee.class);
|
||||
// q.select(emp.type()).where(cb.notEqual(emp.type(), Exempt.class));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
@AllowFailure(message = "Type expression was working with Fay. Now refactored and broken")
|
||||
public void testTypeExpression() {
|
||||
String jpql = "SELECT TYPE(e) FROM Employee e WHERE TYPE(e) <> Exempt";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Employee> emp = q.from(Employee.class);
|
||||
q.select(emp.type()).where(cb.notEqual(emp.type(), Exempt.class));
|
||||
// @AllowFailure(message = "Index expression not implemented")
|
||||
// public void testIndexExpressionAndLietral() {
|
||||
// String jpql = "SELECT w.name FROM Course c JOIN c.studentWaitList w "
|
||||
// + "WHERE c.name = 'Calculus' AND INDEX(w) = 0";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Course> course = q.from(Course.class);
|
||||
// ListJoin<Course, Student> w = course.join(Course_.studentWaitList);
|
||||
// q.where(cb.equal(course.get(Course_.name), "Calculus"),
|
||||
// cb.equal(w.index(), 0)).select(w.get(Student_.name));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "Index expression not implemented")
|
||||
public void testIndexExpressionAndLietral() {
|
||||
String jpql = "SELECT w.name FROM Course c JOIN c.studentWaitList w "
|
||||
+ "WHERE c.name = 'Calculus' AND INDEX(w) = 0";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Course> course = q.from(Course.class);
|
||||
ListJoin<Course, Student> w = course.join(Course_.studentWaitList);
|
||||
q.where(cb.equal(course.get(Course_.name), "Calculus"),
|
||||
cb.equal(w.index(), 0)).select(w.get(Student_.name));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "SQL for Criteria has extra join")
|
||||
public void testAggregateInProjection() {
|
||||
String jpql = "SELECT SUM(i.price) FROM Order o JOIN o.lineItems i JOIN "
|
||||
+ "o.customer c WHERE c.lastName = 'Smith' AND c.firstName = 'John'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
Join<Order, LineItem> i = o.join(Order_.lineItems);
|
||||
Join<Order, Customer> c = o.join(Order_.customer);
|
||||
q.where(cb.equal(c.get(Customer_.lastName), "Smith"), cb.equal(c
|
||||
.get(Customer_.firstName), "John"));
|
||||
q.select(cb.sum(i.get(LineItem_.price)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
// @AllowFailure(message = "SQL for Criteria has extra join")
|
||||
// public void testAggregateInProjection() {
|
||||
// String jpql = "SELECT SUM(i.price) FROM Order o JOIN o.lineItems i JOIN "
|
||||
// + "o.customer c WHERE c.lastName = 'Smith' AND c.firstName = 'John'";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Order> o = q.from(Order.class);
|
||||
// Join<Order, LineItem> i = o.join(Order_.lineItems);
|
||||
// Join<Order, Customer> c = o.join(Order_.customer);
|
||||
// q.where(cb.equal(c.get(Customer_.lastName), "Smith"), cb.equal(c
|
||||
// .get(Customer_.firstName), "John"));
|
||||
// q.select(cb.sum(i.get(LineItem_.price)));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
public void testSizeExpression() {
|
||||
String jpql = "SELECT SIZE(d.employees) FROM Department d "
|
||||
|
@ -341,8 +346,10 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
}
|
||||
|
||||
public void testCaseExpression() {
|
||||
String jpql = "SELECT e.name, CASE WHEN e.rating = 1 THEN e.salary * 1.1 "
|
||||
+ "WHEN e.rating = 2 THEN e.salary * 1.2 ELSE e.salary * 1.01 END "
|
||||
String jpql =
|
||||
"SELECT e.name, CASE WHEN e.rating = 1 THEN e.salary * 1.1 "
|
||||
+ "WHEN e.rating = 2 THEN e.salary * 1.2 ELSE e.salary * "
|
||||
+ "1.01 END "
|
||||
+ "FROM Employee e WHERE e.department.name = 'Engineering'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Employee> e = q.from(Employee.class);
|
||||
|
@ -358,60 +365,60 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "Extra Joins created")
|
||||
public void testExpression1() {
|
||||
String jpql = "SELECT o.quantity, o.totalCost*1.08 AS taxedCost, "
|
||||
+ "a.zipCode FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
+ "WHERE a.state = 'CA' AND a.county = 'Santa Clara'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> cust = q.from(Customer.class);
|
||||
Join<Customer, Order> order = cust.join(Customer_.orders);
|
||||
Join<Customer, Address> address = cust.join(Customer_.address);
|
||||
q.where(cb.equal(address.get(Address_.state), "CA"), cb.equal(address
|
||||
.get(Address_.county), "Santa Clara"));
|
||||
q.select(order.get(Order_.quantity), cb.prod(order
|
||||
.get(Order_.totalCost), 1.08), address.get(Address_.zipCode));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "Type expression in projection not implemented")
|
||||
public void testExpression2() {
|
||||
String jpql = "SELECT TYPE(e) FROM Employee e WHERE TYPE(e) <> Exempt";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Employee> emp = q.from(Employee.class);
|
||||
q.select(emp.type()).where(cb.notEqual(emp.type(), Exempt.class));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "Index expression not implemented")
|
||||
public void testExpression3() {
|
||||
String jpql = "SELECT w.name FROM Course c JOIN c.studentWaitList w "
|
||||
+ "WHERE c.name = 'Calculus' AND INDEX(w) = 0";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Course> course = q.from(Course.class);
|
||||
ListJoin<Course, Student> w = course.join(Course_.studentWaitList);
|
||||
q.where(cb.equal(course.get(Course_.name), "Calculus"),
|
||||
cb.equal(w.index(), 0)).select(w.get(Student_.name));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message = "Generates extra Join")
|
||||
public void testExpression4() {
|
||||
String jpql = "SELECT SUM(i.price) FROM Order o JOIN o.lineItems i JOIN "
|
||||
+ "o.customer c WHERE c.lastName = 'Smith' AND c.firstName = 'John'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
Join<Order, LineItem> i = o.join(Order_.lineItems);
|
||||
Join<Order, Customer> c = o.join(Order_.customer);
|
||||
q.where(cb.equal(c.get(Customer_.lastName), "Smith"), cb.equal(c
|
||||
.get(Customer_.firstName), "John"));
|
||||
q.select(cb.sum(i.get(LineItem_.price)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
// @AllowFailure(message = "Extra Joins created")
|
||||
// public void testExpression1() {
|
||||
// String jpql = "SELECT o.quantity, o.totalCost*1.08 AS taxedCost, "
|
||||
// + "a.zipCode FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
// + "WHERE a.state = 'CA' AND a.county = 'Santa Clara'";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> cust = q.from(Customer.class);
|
||||
// Join<Customer, Order> order = cust.join(Customer_.orders);
|
||||
// Join<Customer, Address> address = cust.join(Customer_.address);
|
||||
// q.where(cb.equal(address.get(Address_.state), "CA"), cb.equal(address
|
||||
// .get(Address_.county), "Santa Clara"));
|
||||
// q.select(order.get(Order_.quantity), cb.prod(order
|
||||
// .get(Order_.totalCost), 1.08), address.get(Address_.zipCode));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message = "Type expression in projection not implemented")
|
||||
// public void testExpression2() {
|
||||
// String jpql = "SELECT TYPE(e) FROM Employee e WHERE TYPE(e) <> Exempt";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Employee> emp = q.from(Employee.class);
|
||||
// q.select(emp.type()).where(cb.notEqual(emp.type(), Exempt.class));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message = "Index expression not implemented")
|
||||
// public void testExpression3() {
|
||||
// String jpql = "SELECT w.name FROM Course c JOIN c.studentWaitList w "
|
||||
// + "WHERE c.name = 'Calculus' AND INDEX(w) = 0";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Course> course = q.from(Course.class);
|
||||
// ListJoin<Course, Student> w = course.join(Course_.studentWaitList);
|
||||
// q.where(cb.equal(course.get(Course_.name), "Calculus"),
|
||||
// cb.equal(w.index(), 0)).select(w.get(Student_.name));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message = "Generates extra Join")
|
||||
// public void testExpression4() {
|
||||
// String jpql = "SELECT SUM(i.price) FROM Order o JOIN o.lineItems i JOIN "
|
||||
// + "o.customer c WHERE c.lastName = 'Smith' AND c.firstName = 'John'";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Order> o = q.from(Order.class);
|
||||
// Join<Order, LineItem> i = o.join(Order_.lineItems);
|
||||
// Join<Order, Customer> c = o.join(Order_.customer);
|
||||
// q.where(cb.equal(c.get(Customer_.lastName), "Smith"), cb.equal(c
|
||||
// .get(Customer_.firstName), "John"));
|
||||
// q.select(cb.sum(i.get(LineItem_.price)));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
public void testExpression5() {
|
||||
String jpql = "SELECT SIZE(d.employees) FROM Department d "
|
||||
|
@ -427,7 +434,8 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
public void testGeneralCaseExpression() {
|
||||
String jpql = "SELECT e.name, CASE "
|
||||
+ "WHEN e.rating = 1 THEN e.salary * 1.1 "
|
||||
+ "WHEN e.rating = 2 THEN e.salary * 1.2 ELSE e.salary * 1.01 END "
|
||||
+ "WHEN e.rating = 2 THEN e.salary * 1.2 ELSE e.salary * "
|
||||
+ "1.01 END "
|
||||
+ "FROM Employee e WHERE e.department.name = 'Engineering'";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Employee> e = q.from(Employee.class);
|
||||
|
@ -519,21 +527,21 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
assertEquivalence(q, jpql, new Object[] { 1 });
|
||||
}
|
||||
|
||||
@AllowFailure(message="add QuotedNumbersInQueries=true otherwise AbstractExpressionBuilder.convertTypes() compliants")
|
||||
public void testParameters4() {
|
||||
String jpql = "SELECT c FROM Customer c Where c.status = ?1 AND "
|
||||
+ "c.name = ?2";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Parameter<Integer> param1 = cb.parameter(Integer.class);
|
||||
Parameter<Integer> param2 = cb.parameter(Integer.class);
|
||||
q.select(c).where(
|
||||
cb.and(cb.equal(c.get(Customer_.status), param1), cb.equal(c
|
||||
.get(Customer_.name), param2)));
|
||||
assertEquivalence(q, jpql, new Object[] { 1, "test" });
|
||||
}
|
||||
// @AllowFailure(message="add QuotedNumbersInQueries=true otherwise " +
|
||||
// "AbstractExpressionBuilder.convertTypes() compliants")
|
||||
// public void testParameters4() {
|
||||
// String jpql = "SELECT c FROM Customer c Where c.status = ?1 AND "
|
||||
// + "c.name = ?2";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// Parameter<Integer> param1 = cb.parameter(Integer.class);
|
||||
// Parameter<Integer> param2 = cb.parameter(Integer.class);
|
||||
// q.select(c).where(
|
||||
// cb.and(cb.equal(c.get(Customer_.status), param1), cb.equal(c
|
||||
// .get(Customer_.name), param2)));
|
||||
// assertEquivalence(q, jpql, new Object[] { 1, "test" });
|
||||
// }
|
||||
|
||||
// @AllowFailure(message = "")
|
||||
public void testParameters5() {
|
||||
String jpql = "SELECT c FROM Customer c Where c.status IN (:coll)";
|
||||
CriteriaQuery q = cb.create();
|
||||
|
@ -548,136 +556,138 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
// {vals});
|
||||
}
|
||||
|
||||
@AllowFailure(message="Value() expression not implemented")
|
||||
public void testSelectList1() {
|
||||
String jpql = "SELECT v.location.street, KEY(i).title, VALUE(i) FROM "
|
||||
+ "VideoStore v JOIN v.videoInventory i WHERE v.location.zipCode = "
|
||||
+ "'94301' AND VALUE(i) > 0";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<VideoStore> v = q.from(VideoStore.class);
|
||||
MapJoin<VideoStore, Movie, Integer> inv = v
|
||||
.join(VideoStore_.videoInventory);
|
||||
q.where(cb.equal(v.get(VideoStore_.location).get(Address_.zipCode),
|
||||
"94301"), cb.gt(inv.value(), 0));
|
||||
q.select(v.get(VideoStore_.location).get(Address_.street), inv.key()
|
||||
.get(Movie_.title), inv.value());
|
||||
// @AllowFailure(message="Value() expression not implemented")
|
||||
// public void testSelectList1() {
|
||||
// String jpql = "SELECT v.location.street, KEY(i).title, VALUE(i) FROM "
|
||||
// + "VideoStore v JOIN v.videoInventory i WHERE v.location.zipCode = "
|
||||
// + "'94301' AND VALUE(i) > 0";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<VideoStore> v = q.from(VideoStore.class);
|
||||
// MapJoin<VideoStore, Movie, Integer> inv = v
|
||||
// .join(VideoStore_.videoInventory);
|
||||
// q.where(cb.equal(v.get(VideoStore_.location).get(Address_.zipCode),
|
||||
// "94301"), cb.gt(inv.value(), 0));
|
||||
// q.select(v.get(VideoStore_.location).get(Address_.street), inv.key()
|
||||
// .get(Movie_.title), inv.value());
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="new() in projection is broken")
|
||||
// public void testSelectList2() {
|
||||
// String jpql =
|
||||
// "SELECT NEW CustomerDetails(c.id, c.status, o.quantity) FROM "
|
||||
// + "Customer c JOIN c.orders o WHERE o.quantity > 100";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
// q.where(cb.gt(o.get(Order_.quantity), 100));
|
||||
// q.select(cb.select(CustomerDetails.class, c.get(Customer_.id), c
|
||||
// .get(Customer_.status), o.get(Order_.quantity)));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="new() in projection is broken")
|
||||
public void testSelectList2() {
|
||||
String jpql = "SELECT NEW CustomerDetails(c.id, c.status, o.quantity) FROM "
|
||||
+ "Customer c JOIN c.orders o WHERE o.quantity > 100";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
q.where(cb.gt(o.get(Order_.quantity), 100));
|
||||
q.select(cb.select(CustomerDetails.class, c.get(Customer_.id), c
|
||||
.get(Customer_.status), o.get(Order_.quantity)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="Subqueries not implemented")
|
||||
public void testSubqueries1() {
|
||||
String jpql = "SELECT goodCustomer FROM Customer goodCustomer WHERE "
|
||||
+ "goodCustomer.balanceOwed < (SELECT AVG(c.balanceOwed) FROM "
|
||||
+ "Customer c)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> goodCustomer = q.from(Customer.class);
|
||||
Subquery<Double> sq = q.subquery(Double.class);
|
||||
Root<Customer> c = sq.from(Customer.class);
|
||||
q.where(cb.lt(goodCustomer.get(Customer_.balanceOwed), sq.select(cb
|
||||
.avg(c.get(Customer_.balanceOwed)))));
|
||||
q.select(goodCustomer);
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="Subqueries not implemented")
|
||||
public void testSubqueries2() {
|
||||
String jpql = "SELECT DISTINCT emp FROM Employee emp WHERE EXISTS ("
|
||||
+ "SELECT spouseEmp FROM Employee spouseEmp WHERE spouseEmp = "
|
||||
+ "emp.spouse)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Employee> emp = q.from(Employee.class);
|
||||
Subquery<Employee> sq = q.subquery(Employee.class);
|
||||
Root<Employee> spouseEmp = sq.from(Employee.class);
|
||||
sq.select(spouseEmp);
|
||||
sq.where(cb.equal(spouseEmp, emp.get(Employee_.spouse)));
|
||||
q.where(cb.exists(sq));
|
||||
q.select(emp).distinct(true);
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="Subqueries not implemented")
|
||||
public void testSubqueries3() {
|
||||
String jpql = "SELECT emp FROM Employee emp WHERE emp.salary > ALL ("
|
||||
+ "SELECT m.salary FROM Manager m WHERE m.department = "
|
||||
+ "emp.department)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Employee> emp = q.from(Employee.class);
|
||||
q.select(emp);
|
||||
Subquery<BigDecimal> sq = q.subquery(BigDecimal.class);
|
||||
Root<Manager> m = sq.from(Manager.class);
|
||||
sq.select(m.get(Manager_.salary));
|
||||
sq.where(cb.equal(m.get(Manager_.department), emp
|
||||
.get(Employee_.department)));
|
||||
q.where(cb.gt(emp.get(Employee_.salary), cb.all(sq)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="Subqueries not implemented")
|
||||
public void testSubqueries4() {
|
||||
String jpql = "SELECT c FROM Customer c WHERE "
|
||||
+ "(SELECT COUNT(o) FROM c.orders o) > 10";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c1 = q.from(Customer.class);
|
||||
q.select(c1);
|
||||
Subquery<Long> sq3 = q.subquery(Long.class);
|
||||
Root<Customer> c2 = sq3.correlate(c1);
|
||||
Join<Customer, Order> o = c2.join(Customer_.orders);
|
||||
q.where(cb.gt(sq3.select(cb.count(o)), 10));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="Subqueries not implemented")
|
||||
public void testSubqueries5() {
|
||||
String jpql = "SELECT o FROM Order o WHERE 10000 < ALL ("
|
||||
+ "SELECT a.balance FROM o.customer c JOIN c.accounts a)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
q.select(o);
|
||||
Subquery<Integer> sq = q.subquery(Integer.class);
|
||||
Root<Order> osq = sq.correlate(o);
|
||||
Join<Order, Customer> c = osq.join(Order_.customer);
|
||||
Join<Customer, Account> a = c.join(Customer_.accounts);
|
||||
sq.select(a.get(Account_.balance));
|
||||
q.where(cb.lt(cb.literal(10000), cb.all(sq)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="Subqueries not implemented")
|
||||
public void testSubqueries6() {
|
||||
String jpql = "SELECT o FROM Order o JOIN o.customer c WHERE 10000 < "
|
||||
+ "ALL (SELECT a.balance FROM c.accounts a)";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Order> o = q.from(Order.class);
|
||||
q.select(o);
|
||||
Join<Order, Customer> c = o.join(Order_.customer);
|
||||
Subquery<Integer> sq = q.subquery(Integer.class);
|
||||
Join<Order, Customer> csq = sq.correlate(c);
|
||||
Join<Customer, Account> a = csq.join(Customer_.accounts);
|
||||
sq.select(a.get(Account_.balance));
|
||||
q.where(cb.lt(cb.literal(10000), cb.all(sq)));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
// @AllowFailure(message="Subqueries not implemented")
|
||||
// public void testSubqueries1() {
|
||||
// String jpql = "SELECT goodCustomer FROM Customer goodCustomer WHERE "
|
||||
// + "goodCustomer.balanceOwed < (SELECT AVG(c.balanceOwed) "
|
||||
// + " FROM "
|
||||
// + "Customer c)";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> goodCustomer = q.from(Customer.class);
|
||||
// Subquery<Double> sq = q.subquery(Double.class);
|
||||
// Root<Customer> c = sq.from(Customer.class);
|
||||
// q.where(cb.lt(goodCustomer.get(Customer_.balanceOwed), sq.select(cb
|
||||
// .avg(c.get(Customer_.balanceOwed)))));
|
||||
// q.select(goodCustomer);
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="Subqueries not implemented")
|
||||
// public void testSubqueries2() {
|
||||
// String jpql = "SELECT DISTINCT emp FROM Employee emp WHERE EXISTS ("
|
||||
// + "SELECT spouseEmp FROM Employee spouseEmp WHERE spouseEmp ="
|
||||
// + " emp.spouse)";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Employee> emp = q.from(Employee.class);
|
||||
// Subquery<Employee> sq = q.subquery(Employee.class);
|
||||
// Root<Employee> spouseEmp = sq.from(Employee.class);
|
||||
// sq.select(spouseEmp);
|
||||
// sq.where(cb.equal(spouseEmp, emp.get(Employee_.spouse)));
|
||||
// q.where(cb.exists(sq));
|
||||
// q.select(emp).distinct(true);
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="Subqueries not implemented")
|
||||
// public void testSubqueries3() {
|
||||
// String jpql = "SELECT emp FROM Employee emp WHERE emp.salary > ALL ("
|
||||
// + "SELECT m.salary FROM Manager m WHERE m.department = "
|
||||
// + "emp.department)";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Employee> emp = q.from(Employee.class);
|
||||
// q.select(emp);
|
||||
// Subquery<BigDecimal> sq = q.subquery(BigDecimal.class);
|
||||
// Root<Manager> m = sq.from(Manager.class);
|
||||
// sq.select(m.get(Manager_.salary));
|
||||
// sq.where(cb.equal(m.get(Manager_.department), emp
|
||||
// .get(Employee_.department)));
|
||||
// q.where(cb.gt(emp.get(Employee_.salary), cb.all(sq)));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="Subqueries not implemented")
|
||||
// public void testSubqueries4() {
|
||||
// String jpql = "SELECT c FROM Customer c WHERE "
|
||||
// + "(SELECT COUNT(o) FROM c.orders o) > 10";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c1 = q.from(Customer.class);
|
||||
// q.select(c1);
|
||||
// Subquery<Long> sq3 = q.subquery(Long.class);
|
||||
// Root<Customer> c2 = sq3.correlate(c1);
|
||||
// Join<Customer, Order> o = c2.join(Customer_.orders);
|
||||
// q.where(cb.gt(sq3.select(cb.count(o)), 10));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="Subqueries not implemented")
|
||||
// public void testSubqueries5() {
|
||||
// String jpql = "SELECT o FROM Order o WHERE 10000 < ALL ("
|
||||
// + "SELECT a.balance FROM o.customer c JOIN c.accounts a)";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Order> o = q.from(Order.class);
|
||||
// q.select(o);
|
||||
// Subquery<Integer> sq = q.subquery(Integer.class);
|
||||
// Root<Order> osq = sq.correlate(o);
|
||||
// Join<Order, Customer> c = osq.join(Order_.customer);
|
||||
// Join<Customer, Account> a = c.join(Customer_.accounts);
|
||||
// sq.select(a.get(Account_.balance));
|
||||
// q.where(cb.lt(cb.literal(10000), cb.all(sq)));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="Subqueries not implemented")
|
||||
// public void testSubqueries6() {
|
||||
// String jpql = "SELECT o FROM Order o JOIN o.customer c WHERE 10000 < "
|
||||
// + "ALL (SELECT a.balance FROM c.accounts a)";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Order> o = q.from(Order.class);
|
||||
// q.select(o);
|
||||
// Join<Order, Customer> c = o.join(Order_.customer);
|
||||
// Subquery<Integer> sq = q.subquery(Integer.class);
|
||||
// Join<Order, Customer> csq = sq.correlate(c);
|
||||
// Join<Customer, Account> a = csq.join(Customer_.accounts);
|
||||
// sq.select(a.get(Account_.balance));
|
||||
// q.where(cb.lt(cb.literal(10000), cb.all(sq)));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
|
||||
public void testGroupByAndHaving() {
|
||||
String jpql = "SELECT c.status, AVG(c.filledOrderCount), COUNT(c) FROM "
|
||||
|
@ -692,135 +702,137 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="AbstractExpressionExecutor.assertNotContainer() not happy")
|
||||
public void testOrdering() {
|
||||
String jpql = "SELECT c FROM Customer c JOIN c.orders o "
|
||||
+ "JOIN c.address a WHERE a.state = 'CA' ORDER BY o.quantity DESC, "
|
||||
+ "o.totalCost";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
Join<Customer, Address> a = c.join(Customer_.address);
|
||||
q.where(cb.equal(a.get(Address_.state), "CA"));
|
||||
q.orderBy(cb.desc(o.get(Order_.quantity)), cb.asc(o
|
||||
.get(Order_.totalCost)));
|
||||
q.select(o);
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
|
||||
jpql = "SELECT o.quantity, a.zipCode FROM Customer c JOIN c.orders "
|
||||
+ "JOIN c.address a WHERE a.state = 'CA' ORDER BY o.quantity, "
|
||||
+ "a.zipCode";
|
||||
q = cb.create();
|
||||
Root<Customer> c1 = q.from(Customer.class);
|
||||
Join<Customer, Order> o1 = c1.join(Customer_.orders);
|
||||
Join<Customer, Address> a1 = c1.join(Customer_.address);
|
||||
q.where(cb.equal(a1.get(Address_.state), "CA"));
|
||||
q.orderBy(cb.asc(o1.get(Order_.quantity)), cb.asc(a1
|
||||
.get(Address_.zipCode)));
|
||||
q.select(o1.get(Order_.quantity), a1.get(Address_.zipCode));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
|
||||
jpql = "SELECT o.quantity, o.cost * 1.08 AS taxedCost, a.zipCode "
|
||||
+ "FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
+ "WHERE a.state = 'CA' AND a.county = 'Santa Clara' "
|
||||
+ "ORDER BY o.quantity, taxedCost, a.zipCode";
|
||||
q = cb.create();
|
||||
Root<Customer> c2 = q.from(Customer.class);
|
||||
Join<Customer, Order> o2 = c2.join(Customer_.orders);
|
||||
Join<Customer, Address> a2 = c2.join(Customer_.address);
|
||||
q.where(cb.equal(a.get(Address_.state), "CA"), cb.equal(a
|
||||
.get(Address_.county), "Santa Clara"));
|
||||
q.orderBy(cb.asc(o.get(Order_.quantity)), cb.asc(cb.prod(
|
||||
o.get(Order_.totalCost), 1.08)),
|
||||
cb.asc(a.get(Address_.zipCode)));
|
||||
q.select(o.get(Order_.quantity), cb.prod(
|
||||
o.get(Order_.totalCost), 1.08), a.get(Address_.zipCode));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="AbstractExpressionExecutor.assertNotContainer() not happy")
|
||||
public void testOrdering1() {
|
||||
String jpql = "SELECT o FROM Customer c JOIN c.orders o "
|
||||
+ "JOIN c.address a WHERE a.state = 'CA' ORDER BY o.quantity DESC, "
|
||||
+ "o.totalCost";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
Join<Customer, Address> a = c.join(Customer_.address);
|
||||
q.where(cb.equal(a.get(Address_.state), "CA"));
|
||||
q.orderBy(cb.desc(o.get(Order_.quantity)), cb.asc(o
|
||||
.get(Order_.totalCost)));
|
||||
q.select(o);
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="The JPQL is broken!")
|
||||
public void testOrdering2() {
|
||||
String jpql = "SELECT o.quantity, a.zipCode FROM Customer c "
|
||||
+ "JOIN c.orders JOIN c.address a WHERE a.state = 'CA' "
|
||||
+ "ORDER BY o.quantity, a.zipCode";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
Join<Customer, Address> a = c.join(Customer_.address);
|
||||
q.where(cb.equal(a.get(Address_.state), "CA"));
|
||||
q.orderBy(cb.asc(o.get(Order_.quantity)), cb.asc(a
|
||||
.get(Address_.zipCode)));
|
||||
q.select(o.get(Order_.quantity), a.get(Address_.zipCode));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="QueryExpression.ordering not initialized")
|
||||
public void testOrdering3() {
|
||||
String jpql = "SELECT o.quantity, o.totalCost * 1.08 AS taxedCost, "
|
||||
+ "a.zipCode FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
+ "WHERE a.state = 'CA' AND a.county = 'Santa Clara' "
|
||||
+ "ORDER BY o.quantity, taxedCost, a.zipCode";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
Join<Customer, Address> a = c.join(Customer_.address);
|
||||
q.where(cb.equal(a.get(Address_.state), "CA"), cb.equal(a
|
||||
.get(Address_.county), "Santa Clara"));
|
||||
q.orderBy(cb.asc(o.get(Order_.quantity)), cb.asc(cb.prod(
|
||||
o.get(Order_.totalCost), 1.08)),
|
||||
cb.asc(a.get(Address_.zipCode)));
|
||||
q.select(o.get(Order_.quantity), cb.prod(
|
||||
o.get(Order_.totalCost), 1.08), a.get(Address_.zipCode));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
|
||||
@AllowFailure(message="QueryExpression.ordering not initialized")
|
||||
public void testOrdering4() {
|
||||
String jpql = "SELECT c FROM Customer c "
|
||||
+ "ORDER BY c.name DESC, c.status";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
q.orderBy(cb.desc(c.get(Customer_.name)), cb.asc(c
|
||||
.get(Customer_.status)));
|
||||
q.select(c);
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="QueryExpression.ordering not initialized")
|
||||
public void testOrdering5() {
|
||||
String jpql = "SELECT c.firstName, c.lastName, c.balanceOwed "
|
||||
+ "FROM Customer c ORDER BY c.name DESC, c.status";
|
||||
CriteriaQuery q = cb.create();
|
||||
Root<Customer> c = q.from(Customer.class);
|
||||
q.orderBy(cb.desc(c.get(Customer_.name)), cb.asc(c
|
||||
.get(Customer_.status)));
|
||||
q.select(c.get(Customer_.firstName), c.get(Customer_.lastName), c
|
||||
.get(Customer_.balanceOwed));
|
||||
|
||||
assertEquivalence(q, jpql);
|
||||
}
|
||||
// @AllowFailure(message="AbstractExpressionExecutor.assertNotContainer()
|
||||
// not happy")
|
||||
// public void testOrdering() {
|
||||
// String jpql = "SELECT c FROM Customer c JOIN c.orders o "
|
||||
// + "JOIN c.address a WHERE a.state = 'CA' ORDER BY o.quantity DESC, "
|
||||
// + "o.totalCost";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
// Join<Customer, Address> a = c.join(Customer_.address);
|
||||
// q.where(cb.equal(a.get(Address_.state), "CA"));
|
||||
// q.orderBy(cb.desc(o.get(Order_.quantity)), cb.asc(o
|
||||
// .get(Order_.totalCost)));
|
||||
// q.select(o);
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
//
|
||||
// jpql = "SELECT o.quantity, a.zipCode FROM Customer c JOIN c.orders "
|
||||
// + "JOIN c.address a WHERE a.state = 'CA' ORDER BY o.quantity, "
|
||||
// + "a.zipCode";
|
||||
// q = cb.create();
|
||||
// Root<Customer> c1 = q.from(Customer.class);
|
||||
// Join<Customer, Order> o1 = c1.join(Customer_.orders);
|
||||
// Join<Customer, Address> a1 = c1.join(Customer_.address);
|
||||
// q.where(cb.equal(a1.get(Address_.state), "CA"));
|
||||
// q.orderBy(cb.asc(o1.get(Order_.quantity)), cb.asc(a1
|
||||
// .get(Address_.zipCode)));
|
||||
// q.select(o1.get(Order_.quantity), a1.get(Address_.zipCode));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
//
|
||||
// jpql = "SELECT o.quantity, o.cost * 1.08 AS taxedCost, a.zipCode "
|
||||
// + "FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
// + "WHERE a.state = 'CA' AND a.county = 'Santa Clara' "
|
||||
// + "ORDER BY o.quantity, taxedCost, a.zipCode";
|
||||
// q = cb.create();
|
||||
// Root<Customer> c2 = q.from(Customer.class);
|
||||
// Join<Customer, Order> o2 = c2.join(Customer_.orders);
|
||||
// Join<Customer, Address> a2 = c2.join(Customer_.address);
|
||||
// q.where(cb.equal(a.get(Address_.state), "CA"), cb.equal(a
|
||||
// .get(Address_.county), "Santa Clara"));
|
||||
// q.orderBy(cb.asc(o.get(Order_.quantity)), cb.asc(cb.prod(
|
||||
// o.get(Order_.totalCost), 1.08)),
|
||||
// cb.asc(a.get(Address_.zipCode)));
|
||||
// q.select(o.get(Order_.quantity), cb.prod(
|
||||
// o.get(Order_.totalCost), 1.08), a.get(Address_.zipCode));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="AbstractExpressionExecutor.assertNotContainer()"+
|
||||
// "not happy")
|
||||
// public void testOrdering1() {
|
||||
// String jpql = "SELECT o FROM Customer c JOIN c.orders o "
|
||||
// + "JOIN c.address a WHERE a.state = 'CA' ORDER BY o.quantity DESC, "
|
||||
// + "o.totalCost";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
// Join<Customer, Address> a = c.join(Customer_.address);
|
||||
// q.where(cb.equal(a.get(Address_.state), "CA"));
|
||||
// q.orderBy(cb.desc(o.get(Order_.quantity)), cb.asc(o
|
||||
// .get(Order_.totalCost)));
|
||||
// q.select(o);
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="The JPQL is broken!")
|
||||
// public void testOrdering2() {
|
||||
// String jpql = "SELECT o.quantity, a.zipCode FROM Customer c "
|
||||
// + "JOIN c.orders JOIN c.address a WHERE a.state = 'CA' "
|
||||
// + "ORDER BY o.quantity, a.zipCode";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
// Join<Customer, Address> a = c.join(Customer_.address);
|
||||
// q.where(cb.equal(a.get(Address_.state), "CA"));
|
||||
// q.orderBy(cb.asc(o.get(Order_.quantity)), cb.asc(a
|
||||
// .get(Address_.zipCode)));
|
||||
// q.select(o.get(Order_.quantity), a.get(Address_.zipCode));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="QueryExpression.ordering not initialized")
|
||||
// public void testOrdering3() {
|
||||
// String jpql = "SELECT o.quantity, o.totalCost * 1.08 AS taxedCost, "
|
||||
// + "a.zipCode FROM Customer c JOIN c.orders o JOIN c.address a "
|
||||
// + "WHERE a.state = 'CA' AND a.county = 'Santa Clara' "
|
||||
// + "ORDER BY o.quantity, taxedCost, a.zipCode";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// Join<Customer, Order> o = c.join(Customer_.orders);
|
||||
// Join<Customer, Address> a = c.join(Customer_.address);
|
||||
// q.where(cb.equal(a.get(Address_.state), "CA"), cb.equal(a
|
||||
// .get(Address_.county), "Santa Clara"));
|
||||
// q.orderBy(cb.asc(o.get(Order_.quantity)), cb.asc(cb.prod(
|
||||
// o.get(Order_.totalCost), 1.08)),
|
||||
// cb.asc(a.get(Address_.zipCode)));
|
||||
// q.select(o.get(Order_.quantity), cb.prod(
|
||||
// o.get(Order_.totalCost), 1.08), a.get(Address_.zipCode));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @AllowFailure(message="QueryExpression.ordering not initialized")
|
||||
// public void testOrdering4() {
|
||||
// String jpql = "SELECT c FROM Customer c "
|
||||
// + "ORDER BY c.name DESC, c.status";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// q.orderBy(cb.desc(c.get(Customer_.name)), cb.asc(c
|
||||
// .get(Customer_.status)));
|
||||
// q.select(c);
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
//
|
||||
// @AllowFailure(message="QueryExpression.ordering not initialized")
|
||||
// public void testOrdering5() {
|
||||
// String jpql = "SELECT c.firstName, c.lastName, c.balanceOwed "
|
||||
// + "FROM Customer c ORDER BY c.name DESC, c.status";
|
||||
// CriteriaQuery q = cb.create();
|
||||
// Root<Customer> c = q.from(Customer.class);
|
||||
// q.orderBy(cb.desc(c.get(Customer_.name)), cb.asc(c
|
||||
// .get(Customer_.status)));
|
||||
// q.select(c.get(Customer_.firstName), c.get(Customer_.lastName), c
|
||||
// .get(Customer_.balanceOwed));
|
||||
//
|
||||
// assertEquivalence(q, jpql);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.apache.openjpa.persistence.criteria;
|
||||
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.criteria.Transaction.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.criteria.Transaction.class)
|
||||
public class Transaction_ {
|
||||
}
|
||||
|
|
|
@ -60,8 +60,9 @@ public class EntityF {
|
|||
private Map<String, String> collectionMap = new HashMap<String, String>();
|
||||
|
||||
@ElementCollection
|
||||
@MapKeyColumn(name="\"mapKey\"")
|
||||
private Map<String, String> delimCollectionMap = new HashMap<String, String>();
|
||||
@MapKeyColumn(name = "\"mapKey\"")
|
||||
private Map<String, String> delimCollectionMap =
|
||||
new HashMap<String, String>();
|
||||
|
||||
public EntityF(String name) {
|
||||
this.name = name;
|
||||
|
|
|
@ -335,8 +335,10 @@ public class TestFieldRange extends BaseKernelTest {
|
|||
|
||||
System.out.println("i1 : " + i1 + "\ni2 : " + i2);
|
||||
|
||||
//CR346162. In this CR, it was stated that @Temporal(DATE) fields will be equal for year, month, day but not for hours,
|
||||
//minutes, seconds. So, we removed the time check and checked only for the equality of day, month and year
|
||||
// CR346162. In this CR, it was stated that @Temporal(DATE) fields will
|
||||
// be equal for year, month, day but not for hours,
|
||||
// minutes, seconds. So, we removed the time check and checked only for
|
||||
// the equality of day, month and year
|
||||
|
||||
/* assertEquals("Field type Date: "
|
||||
+ testDate.getTime() + "!="
|
||||
|
@ -349,11 +351,12 @@ public class TestFieldRange extends BaseKernelTest {
|
|||
if ((testDateDay != retrievedObjectDay) ||
|
||||
(testDateMonth != retrievedObjectMonth) ||
|
||||
(testDateYear != retrievedObjectYear)) {
|
||||
Assert.fail(
|
||||
"Field type Date not stored properly. One or more of the components of the date (day, month or year) do not match. \n" +
|
||||
" Value that should be stored : " + testDate.toGMTString() +
|
||||
". \nValue that is actually" +
|
||||
"stored : " + retrievedObject.getTestDate().toGMTString());
|
||||
Assert
|
||||
.fail("Field type Date not stored properly. One or more of "
|
||||
+ "the components of the date (day, month or year) "
|
||||
+ "do not match. \n" + " Value that should be stored : "
|
||||
+ testDate.toGMTString() + ". \nValue that is actually"
|
||||
+ "stored : " + retrievedObject.getTestDate().toGMTString());
|
||||
}
|
||||
//assertEquals ("Field type Object", testObject,
|
||||
//retrievedObject.getTestObject ());
|
||||
|
|
|
@ -6,7 +6,8 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ArrayMember.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.ArrayMember.class)
|
||||
public class ArrayMember_ {
|
||||
public static volatile Attribute<ArrayMember,Byte[]> Array;
|
||||
public static volatile Attribute<ArrayMember,byte[]> array;
|
||||
|
|
|
@ -6,8 +6,10 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.Embed0.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.Embed0.class)
|
||||
public class Embed0_ {
|
||||
public static volatile Attribute<Embed0,ImplicitFieldAccessSubclass> entity1;
|
||||
public static volatile Attribute<Embed0,ImplicitFieldAccessSubclass>
|
||||
entity1;
|
||||
public static volatile Attribute<Embed0,Long> f1;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.Embed1.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value = org.apache.openjpa.persistence.meta.Embed1.class)
|
||||
public class Embed1_ {
|
||||
public static volatile Attribute<Embed1,ImplicitFieldAccessBase> entity0;
|
||||
public static volatile Attribute<Embed1,String> f1;
|
||||
|
|
|
@ -6,10 +6,13 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ExplicitFieldAccessMixed.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.ExplicitFieldAccessMixed.class)
|
||||
public class ExplicitFieldAccessMixed_ {
|
||||
public static volatile Attribute<ExplicitFieldAccessMixed,Long> f1;
|
||||
public static volatile Attribute<ExplicitFieldAccessMixed,Integer> f2;
|
||||
public static volatile Attribute<ExplicitFieldAccessMixed,ImplicitFieldAccessBase> f4;
|
||||
public static volatile Attribute<ExplicitFieldAccessMixed,ImplicitFieldAccessBase> f5;
|
||||
public static volatile Attribute<ExplicitFieldAccessMixed,
|
||||
ImplicitFieldAccessBase> f4;
|
||||
public static volatile Attribute<ExplicitFieldAccessMixed,
|
||||
ImplicitFieldAccessBase> f5;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,13 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ExplicitFieldAccess.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.ExplicitFieldAccess.class)
|
||||
public class ExplicitFieldAccess_ {
|
||||
public static volatile Attribute<ExplicitFieldAccess,Long> f1;
|
||||
public static volatile Attribute<ExplicitFieldAccess,Integer> f2;
|
||||
public static volatile Attribute<ExplicitFieldAccess,ImplicitFieldAccessBase> f4;
|
||||
public static volatile Attribute<ExplicitFieldAccess,ImplicitFieldAccessBase> f5;
|
||||
public static volatile Attribute<ExplicitFieldAccess,
|
||||
ImplicitFieldAccessBase> f4;
|
||||
public static volatile Attribute<ExplicitFieldAccess,
|
||||
ImplicitFieldAccessBase> f5;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,14 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ExplicitPropertyAccessMixed.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.ExplicitPropertyAccessMixed.class)
|
||||
public class ExplicitPropertyAccessMixed_ {
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,String> f1;
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,ImplicitFieldAccessBase> f3;
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,
|
||||
ImplicitFieldAccessBase> f3;
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,Integer> f4;
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,Short> f5;
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,ImplicitFieldAccessBase> f6;
|
||||
public static volatile Attribute<ExplicitPropertyAccessMixed,
|
||||
ImplicitFieldAccessBase> f6;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,14 @@ package org.apache.openjpa.persistence.meta;
|
|||
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ExplicitPropertyAccess.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value = org.apache.openjpa.persistence.meta.ExplicitPropertyAccess.class)
|
||||
public class ExplicitPropertyAccess_ {
|
||||
public static volatile Attribute<ExplicitPropertyAccess,String> f1;
|
||||
public static volatile Attribute<ExplicitPropertyAccess,String> f3;
|
||||
public static volatile Attribute<ExplicitPropertyAccess,String> f4;
|
||||
public static volatile Attribute<ExplicitPropertyAccess,ImplicitFieldAccessBase> f5;
|
||||
public static volatile Attribute<ExplicitPropertyAccess,ImplicitFieldAccessBase> f6;
|
||||
public static volatile Attribute<ExplicitPropertyAccess, String> f1;
|
||||
public static volatile Attribute<ExplicitPropertyAccess, String> f3;
|
||||
public static volatile Attribute<ExplicitPropertyAccess, String> f4;
|
||||
public static volatile Attribute<ExplicitPropertyAccess,
|
||||
ImplicitFieldAccessBase> f5;
|
||||
public static volatile Attribute<ExplicitPropertyAccess,
|
||||
ImplicitFieldAccessBase> f6;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ import javax.persistence.Transient;
|
|||
*
|
||||
*/
|
||||
@Entity
|
||||
public class ImplicitFieldAccessBase extends ImplicitFieldAccessMappedSuperclass {
|
||||
public class ImplicitFieldAccessBase extends
|
||||
ImplicitFieldAccessMappedSuperclass {
|
||||
private String f0;
|
||||
private int primitiveInt;
|
||||
private Integer boxedInt;
|
||||
|
|
|
@ -10,15 +10,24 @@ import javax.persistence.metamodel.List;
|
|||
import javax.persistence.metamodel.Map;
|
||||
import javax.persistence.metamodel.Set;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ImplicitFieldAccessBase.class)
|
||||
public class ImplicitFieldAccessBase_ extends ImplicitFieldAccessMappedSuperclass_ {
|
||||
public static volatile Attribute<ImplicitFieldAccessBase,Integer> boxedInt;
|
||||
public static volatile Collection<ImplicitFieldAccessBase,ExplicitFieldAccess> collectionRelation;
|
||||
public static volatile Attribute<ImplicitFieldAccessBase,String> f0;
|
||||
public static volatile List<ImplicitFieldAccessBase,ExplicitFieldAccess> listRelation;
|
||||
public static volatile Map<ImplicitFieldAccessBase,Integer,ExplicitFieldAccess> mapRelationKeyBasic;
|
||||
public static volatile Map<ImplicitFieldAccessBase,ExplicitPropertyAccess,ExplicitFieldAccess> mapRelationKeyPC;
|
||||
public static volatile Attribute<ImplicitFieldAccessBase,ExplicitFieldAccess> one2oneRelation;
|
||||
public static volatile Attribute<ImplicitFieldAccessBase,Integer> primitiveInt;
|
||||
public static volatile Set<ImplicitFieldAccessBase,ExplicitFieldAccess> setRelation;
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.ImplicitFieldAccessBase.class)
|
||||
public class ImplicitFieldAccessBase_ extends
|
||||
ImplicitFieldAccessMappedSuperclass_ {
|
||||
public static volatile Attribute<ImplicitFieldAccessBase, Integer> boxedInt;
|
||||
public static volatile Collection<ImplicitFieldAccessBase,
|
||||
ExplicitFieldAccess> collectionRelation;
|
||||
public static volatile Attribute<ImplicitFieldAccessBase, String> f0;
|
||||
public static volatile List<ImplicitFieldAccessBase, ExplicitFieldAccess>
|
||||
listRelation;
|
||||
public static volatile Map<ImplicitFieldAccessBase, Integer,
|
||||
ExplicitFieldAccess> mapRelationKeyBasic;
|
||||
public static volatile Map<ImplicitFieldAccessBase, ExplicitPropertyAccess,
|
||||
ExplicitFieldAccess> mapRelationKeyPC;
|
||||
public static volatile Attribute<ImplicitFieldAccessBase,
|
||||
ExplicitFieldAccess> one2oneRelation;
|
||||
public static volatile Attribute<ImplicitFieldAccessBase,
|
||||
Integer> primitiveInt;
|
||||
public static volatile Set<ImplicitFieldAccessBase,
|
||||
ExplicitFieldAccess> setRelation;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,12 @@ package org.apache.openjpa.persistence.meta;
|
|||
import java.util.Date;
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ImplicitFieldAccessMappedSuperclass.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.
|
||||
ImplicitFieldAccessMappedSuperclass.class)
|
||||
public class ImplicitFieldAccessMappedSuperclass_ {
|
||||
public static volatile Attribute<ImplicitFieldAccessMappedSuperclass,Date> createTime;
|
||||
public static volatile Attribute<ImplicitFieldAccessMappedSuperclass,Long> id;
|
||||
public static volatile Attribute<ImplicitFieldAccessMappedSuperclass,Date>
|
||||
createTime;
|
||||
public static volatile Attribute<ImplicitFieldAccessMappedSuperclass,Long>
|
||||
id;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,11 @@ package org.apache.openjpa.persistence.meta;
|
|||
import javax.persistence.metamodel.Attribute;
|
||||
import javax.persistence.metamodel.Map;
|
||||
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(value=org.apache.openjpa.persistence.meta.ImplicitFieldAccessSubclass.class)
|
||||
@javax.persistence.metamodel.TypesafeMetamodel(
|
||||
value=org.apache.openjpa.persistence.meta.ImplicitFieldAccessSubclass.class)
|
||||
public class ImplicitFieldAccessSubclass_ extends ImplicitFieldAccessBase_ {
|
||||
public static volatile Attribute<ImplicitFieldAccessSubclass,ImplicitFieldAccessBase> base;
|
||||
public static volatile Map<ImplicitFieldAccessSubclass,Embed0,ExplicitPropertyAccess> mapRelationKeyEmbedded;
|
||||
public static volatile Attribute<ImplicitFieldAccessSubclass,
|
||||
ImplicitFieldAccessBase> base;
|
||||
public static volatile Map<ImplicitFieldAccessSubclass,Embed0,
|
||||
ExplicitPropertyAccess> mapRelationKeyEmbedded;
|
||||
}
|
||||
|
|
|
@ -280,7 +280,8 @@ public class TestQuery extends SliceTestCase {
|
|||
assertEquals("Even", SlicePersistence.getSlice(c));
|
||||
|
||||
// While all Manufacturers are stored in "Odd" slice.
|
||||
List makers = em.createQuery("select m from Manufacturer m").getResultList();
|
||||
List makers =
|
||||
em.createQuery("select m from Manufacturer m").getResultList();
|
||||
assertFalse(makers.isEmpty());
|
||||
for (Object m : makers)
|
||||
assertEquals("Odd", SlicePersistence.getSlice(m));
|
||||
|
|
|
@ -278,7 +278,8 @@ public class TestQueryMultiThreaded extends SliceTestCase {
|
|||
/**
|
||||
* This test is currently retired.
|
||||
*
|
||||
* @see <A HREF="https://issues.apache.org/jira/browse/OPENJPA-1044">OPENJPA-1044</A>
|
||||
* @see <A HREF="https://issues.apache.org/jira/browse/OPENJPA-1044">
|
||||
* OPENJPA-1044</A>
|
||||
* for details.
|
||||
*/
|
||||
public void xtestQueryParameterEntity() {
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -706,6 +706,7 @@
|
|||
<configLocation>${checkstyle.config.location}</configLocation>
|
||||
<failsOnError>true</failsOnError>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
@ -744,6 +745,7 @@
|
|||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>${checkstyle.config.location}</configLocation>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
Loading…
Reference in New Issue