openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r880891 - in /openjpa/trunk: openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Date Mon, 16 Nov 2009 18:27:21 GMT
Author: ppoddar
Date: Mon Nov 16 18:27:20 2009
New Revision: 880891

URL: http://svn.apache.org/viewvc?rev=880891&view=rev
Log:
OPENJPA-1381: Ignore preapared query if lock mode changes

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java?rev=880891&r1=880890&r2=880891&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java
Mon Nov 16 18:27:20 2009
@@ -751,6 +751,7 @@
         em.getTransaction().begin();
         Query q2 = em.createQuery(jpql);
         assertEquals(QueryLanguages.LANG_PREPARED_SQL, OpenJPAPersistence.cast(q2).getLanguage());
+        q2.getLockMode();
         q2.setLockMode(LockModeType.OPTIMISTIC);
         assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q2).getLanguage());
         List<Author> authors2 = q2.getResultList();

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=880891&r1=880890&r2=880891&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Mon Nov 16 18:27:20 2009
@@ -377,9 +377,12 @@
 	 */
 	void assertJPQLOrCriteriaQuery() {
         String language = getLanguage();
-        if (!(JPQLParser.LANG_JPQL.equals(language) || CriteriaBuilderImpl.LANG_CRITERIA.equals(language)))
{
-            throw new IllegalStateException(_loc.get("not-jpql-or-criteria-query").getMessage());
+        if (JPQLParser.LANG_JPQL.equals(language) 
+         || QueryLanguages.LANG_PREPARED_SQL.equals(language)
+         || CriteriaBuilderImpl.LANG_CRITERIA.equals(language)) {
+            return;
         }
+        throw new IllegalStateException(_loc.get("not-jpql-or-criteria-query").getMessage());
 	}
 
 	public OpenJPAQuery<X> closeAll() {



Mime
View raw message