Index: src/main/org/castor/jdo/engine/SQLTypeInfos.java =================================================================== RCS file: /scm/castor/castor/src/main/org/castor/jdo/engine/SQLTypeInfos.java,v retrieving revision 1.1 diff -u -r1.1 SQLTypeInfos.java --- src/main/org/castor/jdo/engine/SQLTypeInfos.java 25 Nov 2005 23:37:03 -0000 1.1 +++ src/main/org/castor/jdo/engine/SQLTypeInfos.java 17 Dec 2005 21:30:16 -0000 @@ -19,9 +19,12 @@ import java.io.InputStream; import java.sql.Blob; import java.sql.Clob; +import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; import java.sql.Types; import java.util.Calendar; import java.util.GregorianCalendar; @@ -281,6 +284,15 @@ // by Castor to java.io.InputStream and java.io.Reader, respectively, // while JDBC driver expects java.sql.Blob and java.sql.Clob. switch (sqlType) { + case Types.TIME: + stmt.setTime(index, (Time) value, getCalendar()); + break; + case Types.DATE: + stmt.setDate(index, (Date) value, getCalendar()); + break; + case Types.TIMESTAMP: + stmt.setTimestamp(index, (Timestamp) value, getCalendar()); + break; case Types.FLOAT: case Types.DOUBLE: stmt.setDouble(index, ((Double) value).doubleValue()); Index: src/main/org/exolab/castor/jdo/engine/SQLEngine.java =================================================================== RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/engine/SQLEngine.java,v retrieving revision 1.42 diff -u -r1.42 SQLEngine.java --- src/main/org/exolab/castor/jdo/engine/SQLEngine.java 1 Dec 2005 20:18:53 -0000 1.42 +++ src/main/org/exolab/castor/jdo/engine/SQLEngine.java 17 Dec 2005 21:30:19 -0000 @@ -506,28 +506,40 @@ } private Object idToSQL(int index, Object object) { - if (object == null || _ids[index].convertFrom == null) + if (object == null || _ids[index].convertFrom == null) { return object; + } return _ids[index].convertFrom.convert(object, _ids[index].convertParam); } + /** + * Converts the field value given to the corresponding SQL type as specified + * in the field mapping. + * @param field Number of the field + * @param column Number of the field column + * @param object Object instance to be converted + * @return The converted objefct instance + */ private Object toSQL(int field, int column, Object object) { ColumnInfo col = _fields[field].columns[column]; - if (object == null || col.convertFrom == null) + if (object == null || col.convertFrom == null) { return object; + } return col.convertFrom.convert(object, col.convertParam); } private Object idToJava(int index, Object object) { - if (object == null || _ids[index].convertTo == null) + if (object == null || _ids[index].convertTo == null) { return object; + } return _ids[index].convertTo.convert(object, _ids[index].convertParam); } private Object toJava(int field, int column, Object object) { ColumnInfo col = _fields[field].columns[column]; - if (object == null || col.convertTo == null) + if (object == null || col.convertTo == null) { return object; + } return col.convertTo.convert(object, col.convertParam); } @@ -1982,7 +1994,7 @@ final String name; /** - * SQL type of teh coplumn + * SQL type of the column */ final int sqlType; @@ -2001,8 +2013,16 @@ */ final String convertParam; - ColumnInfo( String name, int type, TypeConvertor convertTo, - TypeConvertor convertFrom, String convertParam ) { + /** + * Creates an instance of ColumnInfo + * @param name Name of the column + * @param type SQL type fo the column + * @param convertTo Type convertor used for converting to SQL type + * @param convertFrom Type convertor used for converting from SQL type + * @param convertParam Type conversion parameter + */ + ColumnInfo(String name, int type, TypeConvertor convertTo, + TypeConvertor convertFrom, String convertParam) { this.name = name; this.sqlType = type; this.convertTo = convertTo; @@ -2010,35 +2030,40 @@ this.convertParam = convertParam; } - /* (non-Javadoc) + /** + * @inheritDoc * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getName() */ public String getName() { return name; } - /* (non-Javadoc) + /** + * @inheritDoc * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getSqlType() */ public int getSqlType() { return sqlType; } - /* (non-Javadoc) + /** + * @inheritDoc * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getConvertTo() */ public TypeConvertor getConvertTo() { return convertTo; } - /* (non-Javadoc) + /** + * @inheritDoc * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getConvertFrom() */ public TypeConvertor getConvertFrom() { return convertFrom; } - /* (non-Javadoc) + /** + * @inheritDoc * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getConvertParam() */ public String getConvertParam() { Index: src/tests/jdo/mysql.xml =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/mysql.xml,v retrieving revision 1.18 diff -u -r1.18 mysql.xml --- src/tests/jdo/mysql.xml 6 Dec 2005 22:25:13 -0000 1.18 +++ src/tests/jdo/mysql.xml 17 Dec 2005 21:30:20 -0000 @@ -4,9 +4,15 @@ +<<<<<<< mysql.xml + + + +======= +>>>>>>> 1.18