openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1134440 - in /openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence: EntityManagerImpl.java QueryImpl.java
Date Fri, 10 Jun 2011 20:53:51 GMT
Author: hthomann
Date: Fri Jun 10 20:53:51 2011
New Revision: 1134440

URL: http://svn.apache.org/viewvc?rev=1134440&view=rev
Log:
OPENJPA-1999: Optional support for non-sequential positional parameters - made additional
changes, per Mike Dick, to QueryImpl ctor.

Modified:
    openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
    openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java

Modified: openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=1134440&r1=1134439&r2=1134440&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Fri Jun 10 20:53:51 2011
@@ -1067,8 +1067,7 @@ public class EntityManagerImpl
     }
 
     protected <T> QueryImpl<T> newQueryImpl(org.apache.openjpa.kernel.Query kernelQuery)
{
-        return new QueryImpl<T>(this, _ret, kernelQuery, _convertPositionalParams
-            && !kernelQuery.getLanguage().equals(QueryLanguages.LANG_SQL));
+        return new QueryImpl<T>(this, _ret, kernelQuery);
     }
 
     /**

Modified: openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=1134440&r1=1134439&r2=1134440&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Fri Jun 10 20:53:51 2011
@@ -45,6 +45,7 @@ import javax.persistence.TemporalType;
 import javax.persistence.TypedQuery;
 import javax.persistence.criteria.ParameterExpression;
 
+import org.apache.openjpa.conf.Compatibility;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.kernel.Broker;
 import org.apache.openjpa.kernel.DelegatingQuery;
@@ -93,7 +94,7 @@ public class QueryImpl<X> implements Ope
     private transient ReentrantLock _lock = null;
 	private HintHandler _hintHandler;
 	private boolean _relaxBindParameterTypeChecking;
-	final private boolean _convertPositionalParams;
+	private boolean _convertPositionalParams;
 	
 	/**
 	 * Constructor; supply factory exception translator and delegate.
@@ -102,12 +103,18 @@ public class QueryImpl<X> implements Ope
 	 * @param ret Exception translator for this query
 	 * @param query The underlying "kernel" query.
 	 */
-	public QueryImpl(EntityManagerImpl em, RuntimeExceptionTranslator ret, org.apache.openjpa.kernel.Query
query,
-        boolean convertPositionalParams) {
+	public QueryImpl(EntityManagerImpl em, RuntimeExceptionTranslator ret, org.apache.openjpa.kernel.Query
query) {
         _em = em;
         _query = new DelegatingQuery(query, ret);
         _lock = new ReentrantLock();
-        _convertPositionalParams = convertPositionalParams;
+        if(query.getLanguage() == QueryLanguages.LANG_SQL) { 
+            _convertPositionalParams = false; 
+        }
+        else { 
+            Compatibility compat  = query.getStoreContext().getConfiguration().getCompatibilityInstance();

+            _convertPositionalParams = compat.getConvertPositionalParametersToNamed();  
 
+        }
+        
     }
 
 	/**
@@ -115,8 +122,8 @@ public class QueryImpl<X> implements Ope
 	 * 
 	 * @deprecated
 	 */
-	public QueryImpl(EntityManagerImpl em, org.apache.openjpa.kernel.Query query, boolean convertPositionalParams)
{
-		this(em, null, query, convertPositionalParams);
+	public QueryImpl(EntityManagerImpl em, org.apache.openjpa.kernel.Query query) {
+		this(em, null, query);
 	}
 
 	/**



Mime
View raw message