openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r768395 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/sqlcache/TestPreparedQueryCache.java
Date Fri, 24 Apr 2009 18:49:46 GMT
Author: ppoddar
Date: Fri Apr 24 18:49:46 2009
New Revision: 768395

URL: http://svn.apache.org/viewvc?rev=768395&view=rev
Log:
OPENJPA-703: Set original query string for prepared query

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

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java?rev=768395&r1=768394&r2=768395&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
Fri Apr 24 18:49:46 2009
@@ -130,6 +130,7 @@
      * query.
      */
     public void setInto(Query q) {
+    	q.setQuery(_id);
         if (!_isProjection)
             q.setCandidateType(_candidate, _subclasses);
     }

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=768395&r1=768394&r2=768395&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
Fri Apr 24 18:49:46 2009
@@ -146,6 +146,18 @@
         assertEquals(jpql, pq.getOriginalQuery());
 	}
 	
+	public void testOriginalJPQLQueryStringIsSetOnPreparedQuery() {
+        String jpql = "select p from Company p";
+        OpenJPAEntityManager em = emf.createEntityManager();
+        OpenJPAQuery q1 = em.createQuery(jpql);
+        q1.getResultList();
+        PreparedQuery pq = getCache().get(jpql);
+        assertNotNull(pq);
+        OpenJPAQuery q2 = em.createQuery(jpql);
+        assertEquals(jpql,q2.getQueryString());
+	}
+
+	
 	public void testExclusionPattern() {
 		OpenJPAEntityManager em = emf.createEntityManager();
 		OpenJPAQuery q1 = em.createQuery(EXCLUDED_QUERY_1);



Mime
View raw message