I've noticed that in 1.0.0, 1.0.1 and 1.1.0-SNAPSHOT I cannot combine WHERE
and ORDER BY if they both use subclass fields. This wasn't a problem in
0.9.7
e.g. these queries work (id is a subclass field, uuid is a superclass
field):
SELECT i FROM News i ORDER BY i.id;
SELECT i FROM News i WHERE i.id > 1;
SELECT i FROM News i WHERE i.uuid > 1 ORDER BY i.uuid;
SELECT i FROM News i WHERE i.id > 1 ORDER BY i.uuid;
SELECT i FROM News i WHERE i.uuid > 1 ORDER BY i.id;
but this query fails:
SELECT i FROM News i WHERE i.id > 1 ORDER BY i.id;
the stack trace follows.
Caused by: <openjpa-1.0.0-r420667:570500 nonfatal general error>
org.apache.openjpa.persistence.Persiste
nceException: ERROR: missing FROM-clause entry for table "t0" {prepstmnt
26955692 SELECT t1.uuid, t2.id,
t2.comment, t2.inheritable, t2.level, t2.role, t2.type, t2.username FROM
FB_METADATA t1 INNER JOIN FB_P
RIVILEGES t2 ON t1.uuid = t2.item_uuid WHERE (t0.id > ?) ORDER BY t1.uuid
ASC [params=(long) 1]} [code=0
, state=42P01]
at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3849)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:83)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)
at
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedException(SelectResult
ObjectProvider.java:155)
at
org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider.handleCheckedEx
ception(QueryCacheStoreQuery.java:634)
at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:40)
at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1223)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:799)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:769)
at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:533)
at
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:235)
at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
at furnace.core.el.EntityFunctions.query1(EntityFunctions.java:71)
t0 should be FB_NEWS
--
View this message in context:
http://www.nabble.com/WHERE-clauses-with-ORDER-BY-subclass-field-tp14290053p14290053.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.