[jbpm-commits] JBoss JBPM SVN: r4968 - jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jun 1 19:26:45 EDT 2009


Author: alex.guizar at jboss.com
Date: 2009-06-01 19:26:44 -0400 (Mon, 01 Jun 2009)
New Revision: 4968

Modified:
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
Log:
JBPM-2294: examples fail against postgresql (RESOLVED)
PostgreSQL did not like the format of the record count SQL query. Changed the query to a more portable form.

Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java	2009-06-01 12:59:16 UTC (rev 4967)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java	2009-06-01 23:26:44 UTC (rev 4968)
@@ -159,9 +159,6 @@
     if (tableNames == null) {
       Configuration configuration = environmentFactory.get(Configuration.class);
       
-      SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
-      Dialect dialect = sessionFactoryImplementor.getDialect();
-
       // loop over all foreign key constraints
       List<String> tableNamesList = new ArrayList<String>();
       Iterator iter = configuration.getTableMappings();
@@ -172,7 +169,7 @@
         }
       }
 
-      tableNames = (String[]) tableNamesList.toArray(new String[tableNamesList.size()]);
+      tableNames = tableNamesList.toArray(new String[tableNamesList.size()]);
       
       environmentFactory.set(TABLE_NAMES_KEY, tableNames);
     }
@@ -181,11 +178,11 @@
     Session session = sessionFactory.openSession();
     try {
       for (String tableName : tableNames) {
-        String countSql = "select count(*) recordCount from "+tableName;
+        String countSql = "select count(*) as RECORD_COUNT_ from "+tableName;
         SQLQuery sqlQuery = session.createSQLQuery(countSql);
-        sqlQuery.addScalar("recordCount", Hibernate.INTEGER);
-        Integer recordCount = (Integer) sqlQuery.uniqueResult();
-        if (recordCount>0) {
+        sqlQuery.addScalar("RECORD_COUNT_", Hibernate.LONG);
+        Long recordCount = (Long) sqlQuery.uniqueResult();
+        if (recordCount>0L) {
           recordsLeft = true;
           log.error("FIXME: JBPM-2004 "+recordCount+" records left in table "+tableName);
         }




More information about the jbpm-commits mailing list