db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r513577 [2/3] - in /db/ojb/trunk/src: java/org/apache/ojb/broker/ java/org/apache/ojb/broker/accesslayer/ java/org/apache/ojb/broker/accesslayer/sql/ java/org/apache/ojb/broker/core/ java/org/apache/ojb/broker/metadata/ java/org/apache/ojb/...
Date Fri, 02 Mar 2007 01:33:47 GMT
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java Thu Mar  1 17:33:44 2007
@@ -26,6 +26,7 @@
 import java.sql.Connection;
 
 import org.apache.ojb.broker.query.LikeCriteria;
+import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 import org.apache.commons.lang.SerializationUtils;
@@ -140,24 +141,34 @@
         return LAST_INSERT + tableName + LIMIT;
     }
 
-    /*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
-	 */
-    public void addPagingSql(StringBuffer anSqlString)
+    public boolean supportsLimit()
     {
-        anSqlString.append(" LIMIT ?,?");
+        return true;
     }
 
-    /*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.ojb.broker.platforms.Platform#supportsPaging()
-	 */
-    public boolean supportsPaging()
+    public StringBuffer addLimitSql(Query query, StringBuffer anSqlString)
+    {
+        return anSqlString.append(" LIMIT ?");
+    }
+
+    public boolean supportsOffset()
     {
         return true;
+    }
+
+    public StringBuffer addPagingSql(Query query, StringBuffer anSqlString)
+    {
+        return anSqlString.append(" LIMIT ?, ?");
+    }
+
+    public boolean limitAfterSelect()
+    {
+        return false;
+    }
+
+    public boolean limitBeforeOffset()
+    {
+        return false;
     }
 
     /**

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java Thu Mar  1 17:33:44 2007
@@ -34,6 +34,7 @@
 
 import org.apache.commons.lang.SerializationUtils;
 import org.apache.ojb.broker.PersistenceBrokerSQLException;
+import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 import org.apache.ojb.broker.util.ClassHelper;
@@ -53,7 +54,7 @@
  * for detailed description.
  *
  * <p>
- * Supported properties on sequence creation:
+ * Implementation configuration properties:
  * </p>
  *
  * <table cellspacing="2" cellpadding="2" border="3" frame="box">
@@ -133,6 +134,7 @@
 
     /**
      * Field value of <code>oracle.jdbc.OracleTypes.CURSOR</code>.
+     *
      * @see #initOracleReflectedVars
      */
     protected int ORACLE_JDBC_TYPE_CURSOR = -10;
@@ -357,11 +359,6 @@
         return false;
     }
 
-    public String createSequenceQuery(String sequenceName)
-    {
-        return "CREATE SEQUENCE " + sequenceName;
-    }
-
     public String createSequenceQuery(String sequenceName, Properties prop)
     {
         /*
@@ -448,4 +445,65 @@
         stmt.registerOutParameter(position, ORACLE_JDBC_TYPE_CURSOR);
     }
 
+    public boolean supportsLimit()
+    {
+        return true;
+    }
+
+    public boolean supportsOffset()
+    {
+        return true;
+    }
+
+    public StringBuffer addLimitSql(Query query, StringBuffer anSqlString)
+    {
+        StringBuffer tmp = new StringBuffer("select * from ( ");
+        tmp.append(anSqlString.toString());
+        tmp.append(" ) a where rownum <= ?");
+        return tmp;
+    }
+
+    public StringBuffer addPagingSql(Query query, StringBuffer anSqlString)
+    {
+        /*
+        See http://asktom.oracle.com/pls/asktom/f?p=100:11:1115003470206423::::P11_QUESTION_ID:127412348064
+        select *
+        from ( select a.*, rownum rnum
+                from ( YOUR_QUERY_GOES_HERE -- including the order by )
+                a where rownum <= MAX_ROWS ) where rnum >= MIN_ROWS
+        */
+        StringBuffer tmp = new StringBuffer("SELECT * FROM ( SELECT foo_.*, rownum rnum_ FROM ( ");
+        tmp.append(anSqlString.toString());
+        tmp.append(" ) foo_ WHERE rownum <= ? ) WHERE rnum_ >= ?");
+        return tmp;
+    }
+
+    public boolean limitAfterSelect()
+    {
+        return false;
+    }
+
+    public boolean limitBeforeOffset()
+    {
+        return true;
+    }
+
+    public int buildLimit(Query query)
+    {
+        int result = 0;
+        if(query.hasLimit())
+        {
+            return query.getEndAtIndex();
+        }
+        else if(query.hasOffset())
+        {
+            return MAX_LIMIT_VALUE;
+        }
+        return result;
+    }
+
+    public int buildOffset(Query query)
+    {
+        return query.getStartAtIndex();
+    }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java Thu Mar  1 17:33:44 2007
@@ -21,6 +21,7 @@
 import java.util.Properties;
 
 import org.apache.ojb.broker.query.LikeCriteria;
+import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.util.sequence.SequenceManagerHelper;
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 
@@ -36,7 +37,7 @@
  * for detailed description.
  *
  * <p>
- * Supported properties on sequence creation:
+ * Implementation configuration properties:
  * </p>
  *
  * <table cellspacing="2" cellpadding="2" border="3" frame="box">
@@ -108,7 +109,6 @@
  * </tr>
  * </table>
  *
- * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
  * @version $Id$
  */
 
@@ -131,11 +131,6 @@
         }
     }
 
-    public String createSequenceQuery(String sequenceName)
-    {
-        return "create sequence " + sequenceName;
-    }
-
     public String createSequenceQuery(String sequenceName, Properties prop)
     {
         /*
@@ -198,32 +193,29 @@
         return "drop sequence " + sequenceName;
     }
 
-    /* (non-Javadoc)
-    * @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
-    */
-    public void addPagingSql(StringBuffer anSqlString)
-    {
-        anSqlString.append(" LIMIT ? OFFSET ?");
+        public boolean supportsLimit()
+    {
+        return true;
     }
 
-    /* (non-Javadoc)
-    * @see org.apache.ojb.broker.platforms.Platform#supportsPaging()
-    */
-    public boolean supportsPaging()
+    public StringBuffer addLimitSql(Query query, StringBuffer anSqlString)
+    {
+        return anSqlString.append(" LIMIT ?");
+    }
+
+    public boolean supportsOffset()
     {
         return true;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.platforms.Platform#bindPagingParameters(java.sql.PreparedStatement, int, int, int)
-     */
-    public int bindPagingParameters(PreparedStatement ps, int index, int startAt, int endAt) throws SQLException
-    {
-        ps.setInt(index, endAt - (startAt - 1));    // number of rows to fetch
-        index++;
-        ps.setInt(index, startAt - 1);              // zero based start
-        index++;
-        return index;
+    public StringBuffer addPagingSql(Query query, StringBuffer anSqlString)
+    {
+        return anSqlString.append(" LIMIT ? OFFSET ?");
+    }
+
+    public boolean limitBeforeOffset()
+    {
+        return true;
     }
 
     /**

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java Thu Mar  1 17:33:44 2007
@@ -24,6 +24,7 @@
 import org.apache.ojb.broker.util.sequence.SequenceManagerHelper;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+import org.apache.ojb.broker.query.Query;
 import org.apache.commons.lang.SerializationUtils;
 
 /**
@@ -182,11 +183,6 @@
         return false;
     }
 
-    public String createSequenceQuery(String sequenceName)
-    {
-        return "CREATE SEQUENCE " + sequenceName;
-    }
-
     public String createSequenceQuery(String sequenceName, Properties prop)
     {
         /*
@@ -270,31 +266,34 @@
         return "select " + tableName +".currval from DUAL";
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
-     */
-    public void addPagingSql(StringBuffer anSqlString)
+    public boolean supportsLimit()
     {
-        anSqlString.append(" ROWNO <= ? ");
+        return true;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.platforms.Platform#bindPagingParameters(java.sql.PreparedStatement, int, int, int)
-     */
-    public int bindPagingParameters(PreparedStatement ps, int index, int startAt, int endAt) throws SQLException
+    public StringBuffer addLimitSql(Query query, StringBuffer anSqlString)
     {
-        
-        ps.setInt(index, endAt - 1);    // IGNORE startAt !!
-        index++;
-        return index;
-    }    
-    
-    /* (non-Javadoc)
-     * @see org.apache.ojb.broker.platforms.Platform#supportsPaging()
-     */
-    public boolean supportsPaging()
+        return anSqlString.append(" LIMIT ?");
+    }
+
+    public boolean supportsOffset()
     {
         return true;
+    }
+
+    public StringBuffer addPagingSql(Query query, StringBuffer anSqlString)
+    {
+        return anSqlString.append(" LIMIT ? ?");
+    }
+
+    public boolean limitBeforeOffset()
+    {
+        return false;
+    }
+
+    public boolean limitAfterSelect()
+    {
+        return false;
     }
 
     public boolean supportsOrderByInSubSelect()

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/AbstractQueryImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/AbstractQueryImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/AbstractQueryImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/AbstractQueryImpl.java Thu Mar  1 17:33:44 2007
@@ -1,10 +1,6 @@
 package org.apache.ojb.broker.query;
 
-import java.io.Serializable;
-
-import org.apache.ojb.broker.PersistenceBrokerInternal;
-
-/* Copyright 2002-2004 The Apache Software Foundation
+/* Copyright 2002-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,10 +15,16 @@
  * limitations under the License.
  */
 
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.ojb.broker.PersistenceBrokerInternal;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+import org.apache.ojb.broker.platforms.Platform;
+
 /**
  * Abstract implemenation of Query interface
  *
- * @author ???
  * @version $Id$
  */
 public abstract class AbstractQueryImpl implements Query, Serializable
@@ -39,6 +41,9 @@
     private boolean selectForUpdate;
     private String postfix;
 
+    private transient Platform platform;
+    private transient JdbcConnectionDescriptor jcd;
+
     public AbstractQueryImpl()
     {
     }
@@ -89,17 +94,11 @@
         return m_withExtents;
     }
 
-    /*
-     * @see Query#getSearchClass()
-     */
     public Class getSearchClass()
     {
         return m_searchClass;
     }
 
-    /*
-     * @see Query#getBaseClass()
-     */
     public Class getBaseClass()
     {
         return m_baseClass;
@@ -118,6 +117,16 @@
         return getEndAtIndex() > NO_END_AT_INDEX
             || getStartAtIndex() > NO_START_AT_INDEX;
     }
+
+    public boolean hasLimit()
+    {
+        return getEndAtIndex() > NO_END_AT_INDEX;
+    }
+
+    public boolean hasOffset()
+    {
+        return getStartAtIndex() > NO_START_AT_INDEX;
+    }
     
     /**
      * @param baseClass The baseClass to set.
@@ -165,11 +174,76 @@
         this.postfix = postfix;
     }
 
+    public Platform getPlatform()
+    {
+        return platform;
+    }
+
+
+    // TODO: Rework the limit/offset support
+    private int[] limitValues = new int[]{};
+    /**
+     * NOTE: This method call is only valid after the query is build, more exactly after method
+     * {@link #prepareLimitAndOffset(StringBuffer)} was performed once.
+     */
+    public int[] getLimitValues()
+    {
+        return limitValues;
+    }
+
+    public StringBuffer prepareLimitAndOffset(StringBuffer stmt)
+    {
+        if(!usePaging() || !jcd.isNativeLimitOffset())
+        {
+            return stmt;
+        }
+
+        StringBuffer result = stmt;
+        Platform pf = getPlatform();
+        //int[] limitValues;
+        // limit with offset
+        if(hasOffset())
+        {
+            if(pf.supportsOffset())
+            {
+                result = pf.addPagingSql(this, result);
+                // check for embedded limit boundaries
+                if(!pf.limitOffsetValuesEmbedded())
+                {
+                    if(pf.limitBeforeOffset())
+                    {
+                        limitValues = new int[]{pf.buildLimit(this), pf.buildOffset(this)};
+                    }
+                    else
+                    {
+                        limitValues = new int[]{pf.buildOffset(this), pf.buildLimit(this)};
+                    }
+                }
+            }// fallback and add only limit if possible
+            else if(pf.supportsLimit())
+            {
+                result = pf.addLimitSql(this, result);
+                // check for embedded limit boundaries
+                if(!pf.limitOffsetValuesEmbedded()) limitValues = new int[]{pf.buildLimit(this)};
+            }
+        }
+        // only limit
+        else if(hasLimit() && pf.supportsLimit())
+        {
+            result = pf.addLimitSql(this, result);
+            // check for embedded limit boundaries
+            if(!pf.limitOffsetValuesEmbedded()) limitValues = new int[]{pf.buildLimit(this)};
+        }
+        return result;
+    }
+
     /**
      * @see org.apache.ojb.broker.query.Query#preprocess(org.apache.ojb.broker.PersistenceBrokerInternal)
      */
-    public void preprocess(PersistenceBrokerInternal aPb)
+    public void preprocess(PersistenceBrokerInternal broker)
     {
-        // do nothing
+        platform = broker.serviceConnectionManager().getSupportedPlatform();
+        jcd = broker.serviceConnectionManager().getConnectionDescriptor();
     }
+
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/Query.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/Query.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/Query.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/Query.java Thu Mar  1 17:33:44 2007
@@ -1,9 +1,5 @@
 package org.apache.ojb.broker.query;
 
-import java.io.Serializable;
-
-import org.apache.ojb.broker.PersistenceBrokerInternal;
-
 /* Copyright 2002-2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,6 +15,10 @@
  * limitations under the License.
  */
 
+import java.io.Serializable;
+
+import org.apache.ojb.broker.PersistenceBrokerInternal;
+
 /**
  * represents Queries that can be used by the OJB PersistenceBroker
  * to retrieve Objects from the underlying DB.
@@ -41,7 +41,6 @@
  * projects without breaking any references. I hope this will be
  * useful for someone.
  *
- * @author Thomas Mahler
  * @version $Id$
  */
 public interface Query extends Serializable
@@ -95,24 +94,41 @@
      * @param endAtIndex ending index, inclusive
      */
     void setEndAtIndex(int endAtIndex);
-    
+
+    /**
+     * Answer true if endIndex and/or startIndex is set.
+     */
+    public boolean usePaging();
+
+    /**
+     * Returns <em>true</em> if the {@link #setEndAtIndex(int)} is set.
+     */
+    public boolean hasLimit();
+
+    /**
+     * Returns <em>true</em> if the {@link #setStartAtIndex(int)} is set.
+     */
+    public boolean hasOffset();
+
     /**
      * @deprecated 
      * @param size
      */
     void fullSize(int size);
     /**
-     * @deprecated use OJBIterator.fullSize()
+     * @deprecated use {@link org.apache.ojb.broker.accesslayer.OJBIterator#fullSize()}.
      */
     int fullSize();
 
+    /**
+     * Internal used method.
+     */
     void setWithExtents(boolean withExtents);
-    boolean getWithExtents();
-    
+
     /**
-     * Answer true if start- and endIndex is set.
+     * Internal used method.
      */
-    public boolean usePaging();
+    boolean getWithExtents();
 
     /**
      * Set fetchSize hint for this Query. Passed to the JDBC driver on the
@@ -159,10 +175,13 @@
     String getQueryAffix();
 
     /**
+     * INTERNAL CALLED METHOD!
      * Preprocess the Query using a PersistenceBroker.
+     * NOTE: This method can be called
+     * more than once before the query is performed.
      *
-     * @param aPb the PersistenceBroker
+     * @param broker The current used broker instance.
      */
-    public void preprocess(PersistenceBrokerInternal aPb);
+    public void preprocess(PersistenceBrokerInternal broker);
 
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteria.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteria.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteria.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteria.java Thu Mar  1 17:33:44 2007
@@ -21,11 +21,9 @@
 
 import org.apache.ojb.broker.metadata.FieldHelper;
 
-
 /**
  * Interface for QueryByCriteria.
  *
- * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
  * @version $Id$
  */
 public interface QueryByCriteria extends Query
@@ -38,9 +36,8 @@
      *
      * @param aPath the path segment ie: allArticlesInGroup
      * @param aClass the Class ie: CdArticle
-     * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
      */
-    public abstract void addPathClass(String aPath, Class aClass);
+    public void addPathClass(String aPath, Class aClass);
 
     /**
      * Set the Class for a path. Used for relationships to extents.<br>
@@ -51,10 +48,9 @@
      *
      * @param aPath the path segment ie: allArticlesInGroup
      * @param aClass the Class ie: CdArticle
-     * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
      * @see #addPathClass
      */
-    public abstract void setPathClass(String aPath, Class aClass);
+    public void setPathClass(String aPath, Class aClass);
 
     /**
      * Get the a List of Class objects used as hints for a path
@@ -62,150 +58,169 @@
      * @param aPath the path segment ie: allArticlesInGroup
      * @return a List o Class objects to be used in SqlStatment
      * @see #addPathClass
-     * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
      */
-    public abstract List getClassesForPath(String aPath);
+    public List getClassesForPath(String aPath);
 
     /**
      * Answer true if outer join for path should be used.
+     *
      * @param aPath the path to query the outer join setting for
      * @return true for outer join
      */
-    public abstract boolean isPathOuterJoin(String aPath);
+    public boolean isPathOuterJoin(String aPath);
 
     /**
      * Force outer join for the last segment of the path.
      * ie. path = 'a.b.c' the outer join will be applied only to the relationship from B to C.
      * if multiple segments need an outer join, setPathOuterJoin needs to be called for each segement.
+     *
      * @param aPath force outer join to the last segment of this path
      */
-    public abstract void setPathOuterJoin(String aPath);
+    public void setPathOuterJoin(String aPath);
 
     /**
-     * @see org.apache.ojb.broker.query.Query#getCriteria()
+     * Returns the {@link Criteria} object.
      */
-    public abstract Criteria getCriteria();
+    public Criteria getCriteria();
 
     /**
-     * @see org.apache.ojb.broker.query.Query#getHavingCriteria()
+     * Returns the HAVING-clause {@link Criteria}.
      */
-    public abstract Criteria getHavingCriteria();
+    public Criteria getHavingCriteria();
 
     /**
      * Sets the distinct.
+     *
      * @param distinct The distinct to set
      */
-    public abstract void setDistinct(boolean distinct);
+    public void setDistinct(boolean distinct);
 
     /**
      * Gets the pathClasses.
      * A Map containing hints about what Class to be used for what path segment
+     *
      * @return Returns a Map
      */
-    public abstract Map getPathClasses();
+    public Map getPathClasses();
 
     /**
      * Sets the criteria.
+     *
      * @param criteria The criteria to set
      */
-    public abstract void setCriteria(Criteria criteria);
+    public void setCriteria(Criteria criteria);
 
     /**
      * Sets the havingCriteria.
+     *
      * @param havingCriteria The havingCriteria to set
      */
-    public abstract void setHavingCriteria(Criteria havingCriteria);
+    public void setHavingCriteria(Criteria havingCriteria);
 
     /**
      * Adds a groupby fieldName for ReportQueries.
+     *
      * @param fieldName The groupby to set
      */
-    public abstract void addGroupBy(String fieldName);
+    public void addGroupBy(String fieldName);
 
     /**
      * Adds a field for groupby
+     *
      * @param aField
      */
-    public abstract void addGroupBy(FieldHelper aField);
+    public void addGroupBy(FieldHelper aField);
 
     /**
      * Adds an array of groupby fieldNames for ReportQueries.
+     *
      * @param fieldNames The groupby to set
      */
-    public abstract void addGroupBy(String[] fieldNames);
+    public void addGroupBy(String[] fieldNames);
 
     /* (non-Javadoc)
      * @see org.apache.ojb.broker.query.Query#getGroupBy()
      */
-    public abstract List getGroupBy();
+    public List getGroupBy();
 
     /**
      * Adds a field for orderBy
-     * @param  fieldName    The field name to be used
-     * @param  sortAscending    true for ASCENDING, false for DESCENDING
+     *
+     * @param fieldName The field name to be used
+     * @param sortAscending true for ASCENDING, false for DESCENDING
      */
-    public abstract void addOrderBy(String fieldName, boolean sortAscending);
+    public void addOrderBy(String fieldName, boolean sortAscending);
 
     /**
      * Adds a field for orderBy
+     *
      * @param aField
      */
-    public abstract void addOrderBy(FieldHelper aField);
+    public void addOrderBy(FieldHelper aField);
 
     /**
      * Adds a field for orderBy ASCENDING
-     * @param  fieldName    The field name to be used
+     *
+     * @param fieldName The field name to be used
      */
-    public abstract void addOrderByAscending(String fieldName);
+    public void addOrderByAscending(String fieldName);
 
     /**
      * Adds an array  of fields for orderBy ASCENDING
-     * @param  fieldName    Array of field names to be used
+     *
+     * @param fieldNames Array of field names to be used
      */
-    public abstract void addOrderByAscending(String[] fieldNames);
+    public void addOrderByAscending(String[] fieldNames);
 
     /**
      * Adds a field for orderBy DESCENDING
-     * @param  fieldName    Array of field names to be used
+     *
+     * @param fieldNames Array of field names to be used
      */
-    public abstract void addOrderByDescending(String[] fieldNames);
+    public void addOrderByDescending(String[] fieldNames);
 
     /**
      * Adds a field for orderBy DESCENDING
-     * @param  fieldName    The field name to be used
+     *
+     * @param fieldName The field name to be used
      */
-    public abstract void addOrderByDescending(String fieldName);
+    public void addOrderByDescending(String fieldName);
 
     /**
-     * @see org.apache.ojb.broker.query.Query#getOrderBy()
+     * Returns a list of all ORDER BY clauses or <em>null</em>
+     * if not set.
+     *
+     * @return A list of {@link org.apache.ojb.broker.metadata.FieldHelper}
+     *         instances or <em>null</em>.
      */
-    public abstract List getOrderBy();
+    public List getOrderBy();
 
     /**
      * add the name of aRelationship for prefetched read
      */
-    public abstract void addPrefetchedRelationship(String aName);
+    public void addPrefetchedRelationship(String aName);
 
     /**
      * Returns the names of Relationships to be prefetched
+     *
      * @return List of Strings
      */
     public List getPrefetchedRelationships();
 
     /**
      * Get a Collection containing all Paths having an Outer-Joins-Setting.
+     *
      * @return a Collection containing the Paths (Strings)
      */
-    public abstract Collection getOuterJoinPaths();
+    public Collection getOuterJoinPaths();
 
-    public abstract String getObjectProjectionAttribute();
+    public String getObjectProjectionAttribute();
 
     /**
      * Use this method to query some related class by object references,
      * for example query.setObjectProjectionAttribute("ref1.ref2.ref3");
      */
-    public abstract void setObjectProjectionAttribute(String objectProjectionAttribute);
-
-    public abstract void setObjectProjectionAttribute(String objectProjectionAttribute, Class objectProjectionClass);
+    public void setObjectProjectionAttribute(String objectProjectionAttribute);
 
+    public void setObjectProjectionAttribute(String objectProjectionAttribute, Class objectProjectionClass);
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java Thu Mar  1 17:33:44 2007
@@ -520,11 +520,12 @@
     /**
      * @see org.apache.ojb.broker.query.Query#preprocess(org.apache.ojb.broker.PersistenceBrokerInternal)
      */
-    public void preprocess(PersistenceBrokerInternal aPb)
+    public void preprocess(PersistenceBrokerInternal broker)
     {
+        super.preprocess(broker);
         if (getCriteria() != null)
         {
-            getCriteria().preprocess(aPb);
+            getCriteria().preprocess(broker);
         }    
     }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByExampleImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByExampleImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByExampleImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByExampleImpl.java Thu Mar  1 17:33:44 2007
@@ -188,8 +188,9 @@
     /**
      * @see org.apache.ojb.broker.query.Query#preprocess(org.apache.ojb.broker.PersistenceBrokerInternal)
      */
-    public void preprocess(PersistenceBrokerInternal aPb)
+    public void preprocess(PersistenceBrokerInternal broker)
     {
-        buildCriteria(aPb);
+        super.preprocess(broker);
+        buildCriteria(broker);
     }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQueryByCriteriaImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQueryByCriteriaImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQueryByCriteriaImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQueryByCriteriaImpl.java Thu Mar  1 17:33:44 2007
@@ -42,7 +42,7 @@
 	/**
 	 * Constructor for ReportQueryByCriteria.
 	 * @param targetClass
-	 * @param attributes[]
+	 * @param attributes
 	 * @param criteria
 	 * @param distinct
 	 */
@@ -55,7 +55,7 @@
 	/**
 	 * Constructor for ReportQueryByCriteria.
 	 * @param targetClass
-	 * @param attributes[]
+	 * @param attributes
 	 * @param criteria
 	 */
     public ReportQueryByCriteriaImpl(Class targetClass, String[] attributes, Criteria criteria)
@@ -176,17 +176,17 @@
     {
         String[] cols = getAttributes();
         StringBuffer buf = new StringBuffer("ReportQuery from ");
-        buf.append(getSearchClass() + " ");
+        buf.append(getSearchClass()).append(" ");
         if (cols != null)
         {
             for (int i = 0; i < cols.length; i++)
             {
-                buf.append(cols[i] + " ");
+                buf.append(cols[i]).append(" ");
             }
         }
         if (getCriteria() != null && !getCriteria().isEmpty())
         {
-            buf.append(" where " + getCriteria());
+            buf.append(" where ").append(getCriteria());
         }
 
         return buf.toString();
@@ -201,7 +201,7 @@
     }
 
     /**
-     * @see ReportQueryByCriteria#setAttributeFieldDescriptors()
+     * @see ReportQueryByCriteria#setAttributeFieldDescriptors(java.util.Map)
      */
     public void setAttributeFieldDescriptors(Map anFldMap)
     {

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java Thu Mar  1 17:33:44 2007
@@ -1195,7 +1195,7 @@
     public Collection getExtentsDescriptors(ClassDescriptor aCld)
     {
         Collection extentClds = m_broker.getDescriptorRepository().getAllConcreteSubclassDescriptors(aCld);
-        Collection allClds = new ArrayList(1 + extentClds.size());
+        List allClds = new ArrayList(1 + extentClds.size());
 
         if (aCld.isMappedToTable())
         {
@@ -1210,7 +1210,7 @@
      * Build a Collection of CldInfos
      * containing the classDescriptor and a collection of concreteClasses.
      */
-    private Collection buildCldInfos(Collection classDescriptors)
+    private Collection buildCldInfos(List classDescriptors)
     {
         Collection result = new ArrayList(classDescriptors.size());
         Iterator iter;

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java Thu Mar  1 17:33:44 2007
@@ -282,6 +282,10 @@
                         msg.append("=");
                         msg.append(fields[i].getPersistentField().get(obj));
                     }
+                    else
+                    {
+                        msg.append("=null");
+                    }
                 }
                 catch(Exception ignore)
                 {

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java Thu Mar  1 17:33:44 2007
@@ -16,6 +16,7 @@
  */
 
 import java.util.Properties;
+import java.sql.Statement;
 
 import org.apache.ojb.broker.PersistenceBrokerInternal;
 import org.apache.ojb.broker.accesslayer.JdbcAccess;
@@ -128,11 +129,10 @@
     }
 
     /**
-     * noop
+     * NOOP
      */
-    public void afterStore(final PersistenceBrokerInternal broker, final JdbcAccess dbAccess, final ClassDescriptor cld, Object obj)
-            throws SequenceManagerException
+    public void afterStore(final PersistenceBrokerInternal broker, JdbcAccess dbAccess, Statement stmt, ClassDescriptor cld, Object obj) throws SequenceManagerException
     {
-        // do nothing
+
     }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/PerFieldManager.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/PerFieldManager.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/PerFieldManager.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/PerFieldManager.java Thu Mar  1 17:33:44 2007
@@ -16,6 +16,7 @@
  */
 
 import java.util.Map;
+import java.sql.Statement;
 
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.ojb.broker.PersistenceBrokerInternal;
@@ -78,7 +79,7 @@
         return sm.getUniqueValue(broker, field);
     }
 
-    public void afterStore(PersistenceBrokerInternal broker, JdbcAccess dbAccess, ClassDescriptor cld, Object obj) throws SequenceManagerException
+    public void afterStore(PersistenceBrokerInternal broker, JdbcAccess dbAccess, Statement stmt, ClassDescriptor cld, Object obj) throws SequenceManagerException
     {
         FieldDescriptor[] pks = cld.getAutoIncrementFields();
         FieldDescriptor result;
@@ -88,7 +89,7 @@
             SequenceManager sm = lookup(broker, result);
             if(sm != null)
             {
-                sm.afterStore(broker, dbAccess, cld, obj);
+                sm.afterStore(broker, dbAccess, stmt, cld, obj);
             }
         }
     }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java Thu Mar  1 17:33:44 2007
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+import java.sql.Statement;
+
 import org.apache.ojb.broker.PersistenceBrokerInternal;
 import org.apache.ojb.broker.accesslayer.JdbcAccess;
 import org.apache.ojb.broker.metadata.ClassDescriptor;
@@ -68,10 +70,11 @@
      * Other implementations may ignore this method.
      *
      * @param broker The current broker instance.
-     * @param dbAccess Current used {@link org.apache.ojb.broker.accesslayer.JdbcAccess} instance
-     * @param cld Descriptor for specified object
-     * @param obj The object to associate with identity value
+     * @param dbAccess The current used {@link org.apache.ojb.broker.accesslayer.JdbcAccess} instance.
+     * @param stmt The current executed {@link Statement}.
+     * @param cld Descriptor for specified object.
+     * @param obj The object to associate with identity value.
      */
-    public void afterStore(PersistenceBrokerInternal broker, JdbcAccess dbAccess, ClassDescriptor cld, Object obj)
+    public void afterStore(PersistenceBrokerInternal broker, JdbcAccess dbAccess, Statement stmt, ClassDescriptor cld, Object obj)
             throws SequenceManagerException;
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java Thu Mar  1 17:33:44 2007
@@ -19,6 +19,7 @@
 import java.util.Map;
 
 import org.apache.commons.lang.SystemUtils;
+import org.apache.commons.lang.BooleanUtils;
 import org.apache.ojb.broker.Identity;
 import org.apache.ojb.broker.OptimisticLockException;
 import org.apache.ojb.broker.PersistenceBrokerInternal;
@@ -116,7 +117,7 @@
         Long start = SequenceManagerHelper.getSeqStart(getConfigurationProperties());
         sequenceStart = start != null ? start.longValue() : 1;
         grabSize = Integer.parseInt(getConfigurationProperty(PROPERTY_GRAB_SIZE, "20"));
-        useGlobalSequenceIdentities = Boolean.getBoolean(getConfigurationProperty(PROPERTY_GLOBAL_SEQUENCE_ID, "false"));
+        useGlobalSequenceIdentities = BooleanUtils.toBoolean(getConfigurationProperty(PROPERTY_GLOBAL_SEQUENCE_ID, "false"));
         // support for deprecated properties
         long globalSequenceStart = Long.parseLong(getConfigurationProperty(PROPERTY_GLOBAL_SEQUENCE_START, "1"));
         if(useGlobalSequenceIdentities && globalSequenceStart > sequenceStart)

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerIdentityImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerIdentityImpl.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerIdentityImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerIdentityImpl.java Thu Mar  1 17:33:44 2007
@@ -19,15 +19,16 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 
+import org.apache.commons.lang.BooleanUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ojb.broker.PersistenceBrokerInternal;
-import org.apache.ojb.broker.platforms.Platform;
 import org.apache.ojb.broker.accesslayer.JdbcAccess;
 import org.apache.ojb.broker.metadata.ClassDescriptor;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.SequenceDescriptor;
 import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
+import org.apache.ojb.broker.platforms.Platform;
 
 /**
  * Sequence manager implementation using native database <tt>Identity columns</tt>
@@ -52,10 +53,12 @@
  * <td><strong>Property Values</strong></td>
  * </tr>
  * <tr>
- * <td>no properties to set</td>
- * <td>
- * <p/>
- * </td>
+ *     <td>seq.generatedKeys</td>
+ *     <td>
+ *          If set <em>true</em> OJB use JDBC 3.0 method <em>Statement.getGeneratedKeys()</em>
+ *          to obtain generated database identity keys. If set <em>false</em> OJB use a separate
+ *          database specific <em>"last identity call"</em> query to request the generated identity key.
+ *     </td>
  * </tr>
  * </table>
  * </p>
@@ -81,6 +84,9 @@
 {
     private Log log = LogFactory.getLog(SequenceManagerIdentityImpl.class);
 
+    public static final String PROPERTY_USE_GENERATED_KEYS = "seq.generatedKeys";
+    private boolean useGeneratedKeys;
+
     /*
      TODO:
      1. Find a better solution (if possible) for this problem
@@ -99,20 +105,48 @@
     public SequenceManagerIdentityImpl(Platform platform, SequenceDescriptor descriptor)
     {
         super(platform, descriptor);
+        init();
+    }
+
+    void init()
+    {
+        useGeneratedKeys = BooleanUtils.toBoolean(getConfigurationProperty(PROPERTY_USE_GENERATED_KEYS, "true"));
     }
 
-    public void afterStore(PersistenceBrokerInternal broker, JdbcAccess dbAccess, ClassDescriptor cld, Object obj)
+    public void afterStore(PersistenceBrokerInternal broker, JdbcAccess dbAccess, Statement stmt, ClassDescriptor cld, Object obj)
             throws SequenceManagerException
     {
         // if database Identity Columns are used, query the id from database
         // thus we have to execute batch entries before
         broker.serviceBatchManager().executeBatch();
+
         FieldDescriptor identityField = extractIdentityColumnField(cld);
         if(identityField != null)
         {
+            // if database Identity Columns are used, query the id from database
+            // thus we have to execute batch entries before
+            broker.serviceBatchManager().executeBatch();
             ifNotReadOnlyFail(identityField);
-            long newId = getLastInsert(broker, cld, identityField);
-            setFieldValue(obj, identityField, new Long(newId));
+            Object val;
+            if(useGeneratedKeys && getPlatform().supportsGetGeneratedKeys())
+            {
+                try
+                {
+                    ResultSet result = getPlatform().getGeneratedKeys(stmt);
+                    result.next();
+                    val = identityField.getJdbcType().getObjectFromColumn(result, 1);
+                    val = identityField.getFieldConversion().sqlToJava(val);
+                }
+                catch(SQLException e)
+                {
+                    throw new SequenceManagerException("Error while extract generated keys from statement", e);
+                }
+            }
+            else
+            {
+                val = new Long(getLastInsert(broker, cld, identityField));
+            }
+            setFieldValue(obj, identityField, val);
         }
     }
 
@@ -201,9 +235,17 @@
                 getSupportedPlatform().getLastInsertIdentityQuery(tableName);
     }
 
-    private void setFieldValue(Object obj, FieldDescriptor field, Long identifier) throws SequenceManagerException
+    private void setFieldValue(Object obj, FieldDescriptor field, Object identifier) throws SequenceManagerException
     {
-        Object result = field.getJdbcType().sequenceKeyConversion(identifier);
+        Object result;
+        if(identifier instanceof Long)
+        {
+            result= field.getJdbcType().sequenceKeyConversion((Long)identifier);
+        }
+        else
+        {
+            result = identifier;
+        }
         result = field.getFieldConversion().sqlToJava(result);
         PersistentField pf = field.getPersistentField();
         pf.set(obj, result);

Modified: db/ojb/trunk/src/samples/org/apache/ojb/tutorials/PBExample.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/samples/org/apache/ojb/tutorials/PBExample.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/samples/org/apache/ojb/tutorials/PBExample.java (original)
+++ db/ojb/trunk/src/samples/org/apache/ojb/tutorials/PBExample.java Thu Mar  1 17:33:44 2007
@@ -49,6 +49,11 @@
             broker = ojb.lookupBroker();
 
             broker.beginTransaction();
+            /*
+            for better performance differ insert/update action
+            broker.store(product, ObjectModification.INSERT);
+            broker.store(product, ObjectModification.UPDATE);
+            */
             broker.store(product);
             broker.commitTransaction();
         }
@@ -150,13 +155,10 @@
         {
             broker = ojb.lookupBroker();
 
-            Criteria criteria = new Criteria();
-
-            criteria.addLessOrEqualThan("stock", new Integer(20));
-            criteria.addGreaterOrEqualThan("price", new Double(100000.0));
-
+            Criteria criteria = new Criteria()
+                    .addLessOrEqualThan("stock", new Integer(20))
+                    .addGreaterOrEqualThan("price", new Double(100000.0));
             QueryByCriteria query = QueryFactory.newQuery(Product.class, criteria);
-
             results = broker.getCollectionByQuery(query);
         }
         catch (PersistenceBrokerException ex)

Modified: db/ojb/trunk/src/schema/ojbtest-schema.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/schema/ojbtest-schema.xml?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/schema/ojbtest-schema.xml (original)
+++ db/ojb/trunk/src/schema/ojbtest-schema.xml Thu Mar  1 17:33:44 2007
@@ -1952,6 +1952,116 @@
 		</foreign-key>
 	</table>
 
+
+	<table name="PAGE_BOOK">
+        <column
+           name="ID_"
+           type="INTEGER"
+           primaryKey="true"
+           autoIncrement="true"/>
+        <column
+           name="TITLE_"
+           type="VARCHAR"/>
+        <column
+           name="DATE_"
+           type="TIMESTAMP"/>
+        <column
+           name="COVER_"
+           type="LONGVARBINARY"/>
+        <column
+           name="VERSION_"
+           type="INTEGER"/>
+        <column
+           name="FK_PUBLISHER"
+           type="INTEGER"/>
+        <foreign-key foreignTable="PAGE_PUBLISHER">
+                <reference local="FK_PUBLISHER" foreign="ID_"/>
+        </foreign-key>
+    </table>
+
+    <table name="PAGE_PUBLICATION">
+        <column
+           name="BOOK_ID"
+           type="INTEGER"
+           primaryKey="true"
+           required="true"/>
+        <column
+           name="AUTHOR_ID"
+           type="INTEGER"
+           primaryKey="true"
+           required="true"/>
+        <foreign-key foreignTable="PAGE_BOOK">
+                <reference local="BOOK_ID" foreign="ID_"/>
+        </foreign-key>
+        <foreign-key foreignTable="PAGE_AUTHOR">
+                <reference local="AUTHOR_ID" foreign="ID_"/>
+        </foreign-key>
+    </table>
+
+    <table name="PAGE_PUBLISHER">
+        <column
+           name="ID_"
+           type="INTEGER"
+           primaryKey="true"
+           autoIncrement="true"/>
+        <column
+           name="NAME_"
+           type="VARCHAR"/>
+        <column
+           name="VERSION_"
+           type="INTEGER"/>
+    </table>
+
+    <table name="PAGE_AUTHOR">
+        <column
+           name="ID_"
+           type="INTEGER"
+           primaryKey="true"
+           autoIncrement="true"/>
+        <column
+           name="NAME_"
+           type="VARCHAR"/>
+        <column
+           name="VERSION_"
+           type="INTEGER"/>
+        <column
+           name="FK_PUBLISHER"
+           type="INTEGER"/>
+        <foreign-key foreignTable="PAGE_PUBLISHER">
+                <reference local="FK_PUBLISHER" foreign="ID_"/>
+        </foreign-key>
+    </table>
+
+    <table name="PAGE_REVIEW">
+        <column
+           name="ID_"
+           type="INTEGER"
+           primaryKey="true"
+           autoIncrement="true"/>
+        <column
+           name="VOTE_"
+           type="INTEGER"/>
+        <column
+           name="SUMMARY_"
+           type="VARCHAR"/>
+        <column
+           name="VERSION_"
+           type="INTEGER"/>
+        <column
+           name="FK_AUTHOR"
+           type="INTEGER"/>
+        <column
+           name="FK_BOOK"
+           type="INTEGER"/>
+        <foreign-key foreignTable="PAGE_AUTHOR">
+                <reference local="FK_AUTHOR" foreign="ID_"/>
+        </foreign-key>
+        <foreign-key foreignTable="PAGE_BOOK">
+                <reference local="FK_BOOK" foreign="ID_"/>
+        </foreign-key>
+    </table>
+
+
   <table name="DeepInnerClass">
       <column name="id"
               javaName="id"

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/AbstractArticle.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/AbstractArticle.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/AbstractArticle.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/AbstractArticle.java Thu Mar  1 17:33:44 2007
@@ -1,6 +1,7 @@
 package org.apache.ojb.broker;
 
 import java.io.Serializable;
+import org.apache.commons.lang.ClassUtils;
 
 /**
  * @ojb.class generate-table-info="false"
@@ -14,7 +15,7 @@
         String groupId = "" + productGroupId;
         String groupName = productGroup != null ? productGroup.getName() : null;
 
-        return "----\n" +
+        return "----" + ClassUtils.getShortClassName(getClass()) + "\n" +
                 "Article No:   " + articleId + "\n" +
                 "Description:  " + articleName + "\n" +
                 "ProductGroupId: " + groupId + "\n" +

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java?view=diff&rev=513577&r1=513576&r2=513577
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/AllTests.java Thu Mar  1 17:33:44 2007
@@ -145,6 +145,7 @@
         suite.addTestSuite(OptimisticLockingMultithreadedTest.class);
         suite.addTestSuite(NoPkReferenceTest.class);
         suite.addTestSuite(UnwrapHelperTest.class);
+        suite.addTestSuite(PaginationTest.class);
         suite.addTestSuite(LOBTest.class);
         suite.addTestSuite(JdbcJavaObjectTest.class);
         suite.addTestSuite(StoredProcedureMaxDBTest.class);



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message