mirror of https://github.com/apache/openjpa.git
Query fixes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@443170 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
913e54c93c
commit
72f7b6b963
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue