roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r515294 - in /incubator/roller/branches/roller_4.0_newbackend: ./ components/core/src/java/org/apache/roller/business/jpa/ src/org/apache/roller/business/jpa/ testdata/ testdata/WEB-INF/classes/ tools/roller-core/
Date Tue, 06 Mar 2007 20:43:32 GMT
Author: snoopdave
Date: Tue Mar  6 12:43:31 2007
New Revision: 515294

URL: http://svn.apache.org/viewvc?view=rev&rev=515294
Log:
OpenJPA now passing all tests against Derby and MySQL

Modified:
    incubator/roller/branches/roller_4.0_newbackend/ant.properties
    incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
    incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAUserManagerImpl.java
    incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAWeblogManagerImpl.java
    incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties
    incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties
    incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar

Modified: incubator/roller/branches/roller_4.0_newbackend/ant.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/ant.properties?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/ant.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/ant.properties Tue Mar  6 12:43:31 2007
@@ -34,7 +34,7 @@
 #test.db.initTask=init-db
 #test.db.stopTask=nothing
 #test.db.name=mysql
-#test.db.cpath=/Users/dave/tomcat/common/lib/mysql-connector-java-3.1.6-bin.jar
+#test.db.cpath=/Users/dave/tomcat/common/lib/mysql-connector-java-3.1.14-bin.jar
 #test.db.driver=com.mysql.jdbc.Driver
 #test.db.url=jdbc:mysql://localhost:3306/rollertest
 #test.db.username=scott

Modified: incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
Tue Mar  6 12:43:31 2007
@@ -221,7 +221,7 @@
         EntityManager em = getEntityManager(false);
         Query q = em.createNamedQuery(queryName);
         // Never flush for queries. Roller code assumes this behavior
-        q.setFlushMode(FlushModeType.COMMIT);
+        //q.setFlushMode(FlushModeType.COMMIT);
         return q;
     }
     
@@ -235,7 +235,7 @@
         EntityManager em = getEntityManager(false);
         Query q = em.createQuery(queryString);
         // Never flush for queries. Roller code assumes this behavior
-        q.setFlushMode(FlushModeType.COMMIT);
+        //q.setFlushMode(FlushModeType.COMMIT);
         return q;
     }
     

Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAUserManagerImpl.java?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAUserManagerImpl.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAUserManagerImpl.java
Tue Mar  6 12:43:31 2007
@@ -213,12 +213,12 @@
     
     protected void updateTagAggregates(List tags) throws RollerException {
         for(Iterator iter = tags.iterator(); iter.hasNext();) {
-            TagStat stat = (TagStat) iter.next();
+            TagStat stat = (TagStat) iter.next();            
             Query query = strategy.getNamedUpdate(
-                    "WeblogEntryTagAggregateData.updateMinusFromTotalByName&WeblogNull");
-            query.setParameter(1, Integer.valueOf(stat.getCount()));
-            query.setParameter(2, stat.getName());
-            query.executeUpdate();
+                "WeblogEntryTagAggregateData.getByName&WebsiteNullOrderByLastUsedDesc");
+            query.setParameter(1, stat.getName());
+            WeblogEntryTagAggregateData agg = (WeblogEntryTagAggregateData)query.getSingleResult();
+            agg.setTotal(agg.getTotal() - stat.getCount());
         }
     }
     

Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAWeblogManagerImpl.java?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAWeblogManagerImpl.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAWeblogManagerImpl.java
Tue Mar  6 12:43:31 2007
@@ -517,7 +517,19 @@
         List params = new ArrayList();
         int size = 0;
         StringBuffer queryString = new StringBuffer();
-        queryString.append("SELECT e FROM WeblogEntryData e WHERE ");
+        
+        if (tags == null) {
+            queryString.append("SELECT e FROM WeblogEntryData e WHERE ");
+        } else {
+            queryString.append("SELECT e FROM WeblogEntryData e JOIN e.tags t WHERE ");
+            queryString.append("(");
+            for(int i = 0; i < tags.size(); i++) {
+                if (i != 0) queryString.append(" OR ");
+                params.add(size++, tags.get(i));
+                queryString.append(" t.name = ?").append(size);                
+            }
+            queryString.append(") AND ");
+        }
         
         if (website != null) {
             params.add(size++, website.getId());
@@ -546,31 +558,7 @@
             params.add(size++, cat.getId());
             queryString.append(" AND e.category.id = ?").append(size);
         }
-        
-        if (tags != null && tags.size() > 0) {            
-            //for(int i = 0; i < tags.size(); i++) {
-                //params.add(size++, tags.get(i));
-                //queryString.append(" AND e.tags.name = ?").append(size);              
 
-            //}
-            
-            // A JOIN with WeblogEntryTagData in parent quert will cause a DISTINCT in SELECT
clause
-            // WeblogEntryData has a clob field and many databases do not link DISTINCT for
CLOB fields
-            // Hence as a workaround using corelated EXISTS query.
-            queryString.append(" AND EXISTS (SELECT t FROM WeblogEntryTagData t WHERE "
-                    + " t.weblogEntry = e AND t.name IN (");
-            final String PARAM_SEPERATOR = ", ";
-            for(int i = 0; i < tags.size(); i++) {
-                params.add(size++, tags.get(i));
-                queryString.append("?").append(size).append(PARAM_SEPERATOR);
-            }
-            // Remove the trailing PARAM_SEPERATOR
-            queryString.delete(queryString.length() - PARAM_SEPERATOR.length(),
-                    queryString.length());
-            
-            // Close the brace FOR IN clause and EXIST clause
-            queryString.append(" ) )");
-        }
-        
+                
         if (status != null) {
             params.add(size++, status);
             queryString.append(" AND e.status = ?").append(size);

Modified: incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties
Tue Mar  6 12:43:31 2007
@@ -17,6 +17,7 @@
 
 openjpa.IgnoreChanges=true
 openjpa.FlushBeforeQueries=true
+openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
 
 # OpenJPA and Derby
 openjpa.ConnectionDriverName=org.apache.derby.jdbc.ClientDriver
@@ -29,7 +30,6 @@
 #openjpa.ConnectionURL=jdbc:mysql://localhost:3306/rollertest
 #openjpa.ConnectionUserName=scott
 #openjpa.ConnectionPassword=tiger
-#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
 
 #openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
 

Modified: incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties Tue
Mar  6 12:43:31 2007
@@ -11,11 +11,11 @@
 
 search.index.dir=search-index
 
-#jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
-#jdbc.connectionURL=jdbc:derby://localhost:3219/roller
-#jdbc.username=APP
-#jdbc.password=APP
-#hibernate.dialect=org.hibernate.dialect.DerbyDialect
+jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
+jdbc.connectionURL=jdbc:derby://localhost:3219/roller
+jdbc.username=APP
+jdbc.password=APP
+hibernate.dialect=org.hibernate.dialect.DerbyDialect
 
 #jdbc.driverClass=com.mysql.jdbc.Driver
 #jdbc.connectionURL=jdbc:mysql://localhost:3306/rollertest

Modified: incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar?view=diff&rev=515294&r1=515293&r2=515294
==============================================================================
Binary files - no diff available.



Mime
View raw message