openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r687122 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/exps/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-kernel/src/mai...
Date Tue, 19 Aug 2008 18:42:27 GMT
Author: ppoddar
Date: Tue Aug 19 11:42:26 2008
New Revision: 687122

URL: http://svn.apache.org/viewvc?rev=687122&view=rev
Log:
Generate informative error message when query fails due to wrong unbound variables

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/exps/localizer.properties
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
    openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java?rev=687122&r1=687121&r2=687122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
Tue Aug 19 11:42:26 2008
@@ -442,6 +442,9 @@
                 // unbound vars are cross-joined to the candidate table
                 var = (Variable) action.data;
                 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.crossJoin(_candidate.getTable(), 
                     rel.getTable());

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/exps/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/exps/localizer.properties?rev=687122&r1=687121&r2=687122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/exps/localizer.properties
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/exps/localizer.properties
Tue Aug 19 11:42:26 2008
@@ -23,6 +23,7 @@
 const-only: The filter listener "{0}" requires a constant argument.	
 path-only: The target for filter listener "{0}" must be "this" or some \
 	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.
 cant-convert: Attempt to compare incompatible types "{0}" and "{1}".
+invalid-unbound-var: Invalid unbound variable "{0}" in query. 
\ No newline at end of file

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?rev=687122&r1=687121&r2=687122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Tue
Aug 19 11:42:26 2008
@@ -854,7 +854,8 @@
             } catch (OpenJPAException ke) {
                 throw ke;
             } catch (Exception e) {
-                throw new UserException(e);
+                throw new UserException(_loc.get("query-execution-error", 
+                		_query), e);
             } finally {
                 _broker.endOperation();
             }

Modified: openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties?rev=687122&r1=687121&r2=687122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
Tue Aug 19 11:42:26 2008
@@ -403,3 +403,5 @@
 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 \
 	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. 
\ No newline at end of file



Mime
View raw message