diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java index f3cdabd26..4225e55da 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java @@ -245,6 +245,13 @@ class PCPath : _class.getPrimaryKeyColumns(); } + public boolean isVariable() { + if (_actions == null) + return false; + Action action = (Action) _actions.getLast(); + return action.op == Action.UNBOUND_VAR || action.op == Action.VAR; + } + public void get(FieldMetaData field, boolean nullTraversal) { if (_actions == null) _actions = new LinkedList(); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java index 29edc6b6d..8c2b2dcde 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java @@ -660,8 +660,8 @@ public class MappingTool ClassMapping mapping = repos.getMapping(cls, null, false); if (mapping != null) return mapping; - if (!validate || cls.isInterface() || - repos.getPersistenceAware(cls) != null) + if (!validate || cls.isInterface() + || repos.getPersistenceAware(cls) != null) return null; throw new MetaDataException(_loc.get("no-meta", cls)); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java index 588551c2c..8031cf989 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java @@ -299,6 +299,10 @@ public class ExpressionStoreQuery * Throw proper exception if given value is a collection/map/array. */ protected void assertNotContainer(Value val, StoreQuery q) { + // variables represent container elements, not the container itself + if (val.isVariable()) + return; + Class type; if (val instanceof Path) { FieldMetaData fmd = ((Path) val).last(); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java index 40c0e3899..3a013e5f5 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java @@ -1358,7 +1358,7 @@ class JPQLExpressionBuilder // determind how to evauate a variabe if (!val.isVariable()) return val; - else if (handleVar == VAR_PATH) + else if (handleVar == VAR_PATH && !(val instanceof Path)) return newPath(val, val.getMetaData()); else if (handleVar == VAR_ERROR) throw parseException(EX_USER, "unexpected-var", diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java index 973a2a7e6..ae7c325df 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java @@ -92,11 +92,6 @@ public class MetaDataRepository private static final Localizer _loc = Localizer.forPackage (MetaDataRepository.class); - // number of metadatas that have been registered thus far. This does not - // include dynamically-generated subclasses; it is just the count of - // user-created metadatas that were registered. - private int _count = 0; - // system sequence private SequenceMetaData _sysSeq = null; @@ -742,7 +737,6 @@ public class MetaDataRepository if (_pawares.containsKey(cls)) throw new MetaDataException(_loc.get("pc-and-aware", cls)); _metas.put(cls, meta); - _count++; } return meta; } @@ -863,7 +857,6 @@ public class MetaDataRepository Class impl = (Class) _ifaces.remove(cls); if (impl != null) _metas.remove(impl); - _count--; return true; } return false;