Index: cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandler.java =================================================================== --- cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandler.java (revision 8352) +++ cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandler.java (working copy) @@ -21,10 +21,71 @@ import org.exolab.castor.jdo.PersistenceException; +/** + * Interface for various type handlers. The type handler handles + * integer, BigDecimal, Long and String values depending on the database engine. + * + * @param Name of KeyGeneratorTypeHandler interface. + * + * @author Ahmad Hassan + * @author Ralf Joachim + * @version $Revision$ $Date: 2009-07-13 17:22:43 (Tue, 28 Jul 2009) $ + */ public interface KeyGeneratorTypeHandler { + //----------------------------------------------------------------------------------- + + /** + * Gets the value from resultset by calling getValue method and then + * calls the increment method to increment the extracted value. + * + * @param rs A ResultSet object. + * @return Returns the new value after incrementing it. + * @throws PersistenceException If ResultSet is empty or if the type handler + * should fail when current row of the record set is not valid, + * @throws SQLException If database error occurs. + */ T getNextValue(ResultSet rs) throws PersistenceException, SQLException; + + /** + * Reads the resultset and return the extracted typehandler value from the + * resultset. + * + * @param rs ResultSet object + * @return Value extracted from the ResultSet. + * @throws PersistenceException If ResultSet is empty or if the type handler + * should fail when current row of the record set is not valid, + * @throws SQLException If database error occurs. + */ T getValue(ResultSet rs) throws PersistenceException, SQLException; + + /** + * Increments the provided value by ONE. + * + * @param value value to be incremented. + * @return Modified TypeHandler object with incremented value.. + */ T increment(T value); + + /** + * Adds the new Type Handler of type T to the provided handler instance at + * the provided offset. + * + * @param value Handler instance in which new value will be added + * @param offset Offset location. * + * @return Modified object. + */ T add(T value, int offset); + + /** + * Binds the value in the sql preparedstatement at the provided index + * location. + * + * @param stmt A SQL PreparedStatement. + * @param index Index location for binding parameter to statement. + * @param value Value to be binded + * @throws SQLException If SQL error occurs in binding param to sql statement. + */ void bindValue(PreparedStatement stmt, int index, T value) throws SQLException; -} + + //----------------------------------------------------------------------------------- +} \ No newline at end of file Index: cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerBigDecimal.java =================================================================== --- cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerBigDecimal.java (revision 8352) +++ cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerBigDecimal.java (working copy) @@ -23,6 +23,13 @@ import org.castor.core.util.Messages; import org.exolab.castor.jdo.PersistenceException; +/** + * Class implementing the KeyGeneratorTypeHandler for BigDecimal type. + * + * @author Ahmad Hassan + * @author Ralf Joachim + * @version $Revision$ $Date: 2009-07-13 17:22:43 (Tue, 28 Jul 2009) $ + */ public final class KeyGeneratorTypeHandlerBigDecimal implements KeyGeneratorTypeHandler { /** Value to be returned by getValue() method if current row of the record set is not valid Index: cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerInteger.java =================================================================== --- cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerInteger.java (revision 8352) +++ cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerInteger.java (working copy) @@ -22,6 +22,13 @@ import org.castor.core.util.Messages; import org.exolab.castor.jdo.PersistenceException; +/** + * Class implementing the KeyGeneratorTypeHandler for Integer type. + * + * @author Ahmad Hassan + * @author Ralf Joachim + * @version $Revision$ $Date: 2009-07-13 17:22:43 (Tue, 28 Jul 2009) $ + */ public final class KeyGeneratorTypeHandlerInteger implements KeyGeneratorTypeHandler { /** Value to be returned by getValue() method if current row of the record set is not valid Index: cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerLong.java =================================================================== --- cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerLong.java (revision 8352) +++ cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerLong.java (working copy) @@ -22,6 +22,13 @@ import org.castor.core.util.Messages; import org.exolab.castor.jdo.PersistenceException; +/** + * Class implementing the KeyGeneratorTypeHandler for Long type. + * + * @author Ahmad Hassan + * @author Ralf Joachim + * @version $Revision$ $Date: 2009-07-13 17:22:43 (Tue, 28 Jul 2009) $ + */ public final class KeyGeneratorTypeHandlerLong implements KeyGeneratorTypeHandler { /** Value to be returned by getValue() method if current row of the record set is not valid Index: cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerString.java =================================================================== --- cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerString.java (revision 8352) +++ cpa/src/main/java/org/castor/cpa/persistence/sql/keygen/KeyGeneratorTypeHandlerString.java (working copy) @@ -22,6 +22,13 @@ import org.castor.core.util.Messages; import org.exolab.castor.jdo.PersistenceException; +/** + * Class implementing the KeyGeneratorTypeHandler for String type. + * + * @author Ahmad Hassan + * @author Ralf Joachim + * @version $Revision$ $Date: 2009-07-13 17:22:43 (Tue, 28 Jul 2009) $ + */ public final class KeyGeneratorTypeHandlerString implements KeyGeneratorTypeHandler { /** Value to be returned by getValue() method if current row of the record set is not valid Index: src/doc/release-notes.xml =================================================================== --- src/doc/release-notes.xml (revision 8355) +++ src/doc/release-notes.xml (working copy) @@ -91,6 +91,26 @@ ]]> + + + Add missing javadoc to KeyGeneratorTypeHandler interface and its implementations. + + + Ahmad Hassan + ahmad.hassan@gmail.com + + + Ralf Joachim + ralf.joachim@syscon.eu + + + Ahmad Hassan + ahmad.hassan@gmail.com + + Enh. + JDO + 20090811 + Improve SQL Insert class hierarchy to treat Sequence NextVal as an Expression.