JPA: COUNT broken for subqueries
Bug #765731 reported by
Maia Everett
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Querydsl |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
JPASubQuery.count() fails under OpenJPA 2.1.0. It attempts to use COUNT(*), which results in a JPQL error.
Instead, it should use COUNT(path-list), using the list of paths from the query's FROM clause.
Similarly, JPASubQuery.
To post a comment you must log in.
Fixed in in SVN trunk :
@Test
assertToString ("(select count(cat) from Cat cat)", sub().from( cat).count( ));
public void Count() {
}
@Test
assertToString ("(select count(cat) from Cat cat)", sub().from( cat).list( cat).count( ));
public void Count_Via_List(){
}
@Test
assertToString ("(select count(cat.name) from Cat cat)", sub().from( cat).list( cat.name) .count( ));
public void Count_Name() {
}
@Test Sources( ) {
assertToString ("(select count(cat, other) from Cat cat, Cat other)", sub().from(cat, other).count());
public void Count_Multiple_
QCat other = new QCat("other");
}
@Test Sources_ Via_List( ) {
assertToString ("(select count(cat, other) from Cat cat, Cat other)", sub().from(cat, other).list(cat, other).count());
public void Count_Multiple_
QCat other = new QCat("other");
}