mirror of https://github.com/apache/openjpa.git
Generate informative error message when query fails due to wrong unbound variables
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@687122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ff93b1d6e6
commit
4dd92231c5
|
@ -442,6 +442,9 @@ public class PCPath
|
||||||
// unbound vars are cross-joined to the candidate table
|
// unbound vars are cross-joined to the candidate table
|
||||||
var = (Variable) action.data;
|
var = (Variable) action.data;
|
||||||
rel = (ClassMapping) var.getMetaData();
|
rel = (ClassMapping) var.getMetaData();
|
||||||
|
if (rel == null)
|
||||||
|
throw new IllegalArgumentException(_loc.get(
|
||||||
|
"invalid-unbound-var", var.getName()).toString());
|
||||||
pstate.joins = pstate.joins.setVariable(var.getName());
|
pstate.joins = pstate.joins.setVariable(var.getName());
|
||||||
pstate.joins = pstate.joins.crossJoin(_candidate.getTable(),
|
pstate.joins = pstate.joins.crossJoin(_candidate.getTable(),
|
||||||
rel.getTable());
|
rel.getTable());
|
||||||
|
|
|
@ -23,6 +23,7 @@ no-in-mem: The filter listener "{0}" does not support in-memory operation; it \
|
||||||
const-only: The filter listener "{0}" requires a constant argument.
|
const-only: The filter listener "{0}" requires a constant argument.
|
||||||
path-only: The target for filter listener "{0}" must be "this" or some \
|
path-only: The target for filter listener "{0}" must be "this" or some \
|
||||||
field traversal to a related objects, such as "company.address".
|
field traversal to a related objects, such as "company.address".
|
||||||
no-col: The column "{0}" given to filter "{1}" doesn''t exist in the table \
|
no-col: The column "{0}" given to filter "{1}" does not exist in the table \
|
||||||
of the specified target.
|
of the specified target.
|
||||||
cant-convert: Attempt to compare incompatible types "{0}" and "{1}".
|
cant-convert: Attempt to compare incompatible types "{0}" and "{1}".
|
||||||
|
invalid-unbound-var: Invalid unbound variable "{0}" in query.
|
|
@ -854,7 +854,8 @@ public class QueryImpl
|
||||||
} catch (OpenJPAException ke) {
|
} catch (OpenJPAException ke) {
|
||||||
throw ke;
|
throw ke;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new UserException(e);
|
throw new UserException(_loc.get("query-execution-error",
|
||||||
|
_query), e);
|
||||||
} finally {
|
} finally {
|
||||||
_broker.endOperation();
|
_broker.endOperation();
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,3 +403,5 @@ fetch-configuration-stack-empty: Fetch configuration stack is empty.
|
||||||
gap-query-param: Parameter {1} for query "{0}" exceeds the number of {2} \
|
gap-query-param: Parameter {1} for query "{0}" exceeds the number of {2} \
|
||||||
bound parameters with following values "{3}". This can happen if you have \
|
bound parameters with following values "{3}". This can happen if you have \
|
||||||
declared but missed to bind values for one or more parameters.
|
declared but missed to bind values for one or more parameters.
|
||||||
|
query-execution-error: Failed to execute query "{0}". Check the query syntax \
|
||||||
|
for correctness. See nested exception for details.
|
Loading…
Reference in New Issue