[ http://issues.apache.org/jira/browse/IBATIS-86?page=comments#action_60430 ] knprince commented on IBATIS-86: --------------------------------
Please find attached sql map file. We have been using postgres 7.2 on linux and everything was working fine. I have installed postgres 8.0 and jdbc driver 8.0-310 JDBC 3(from http://jdbc.postgresql.org/download.html) then the issues started. sql map file : <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap namespace="Export"> <typeAlias alias="exportQuery" type="com.htcinc.dms.domain.ExportDocsQuery"/> <resultMap id="exportResult" class="exportQuery"> <result property="exportID" column="export_id"/> <result property="userID" column="user_id"/> <result property="userName" column="user_name"/> <result property="lastName" column="last_name"/> <result property="firstName" column="first_name"/> <result property="middleName" column="middle_name"/> <result property="userEmail" column="email"/> <result property="itemTypeId" column="item_type_id"/> <result property="documentTypeId" column="document_type_id"/> <result property="loadedFromDate" column="loaded_from_date" /> <result property="loadedToDate" column="loaded_to_date" /> <result property="loadDateOperand" column="loaded_date_operand" /> <result property="createdBy" column="created_by" /> <result property="createdOn" column="created_on" /> <result property="modifiedBy" column="modified_by" /> <result property="modifiedOn" column="modified_on" /> </resultMap> <insert id="insertExportQuery" parameterClass="exportQuery"> INSERT INTO DMS_EXPORT_DOCS (EXPORT_ID, USER_ID, USER_NAME, LAST_NAME, FIRST_NAME, MIDDLE_NAME, EMAIL, ITEM_TYPE_ID, DOCUMENT_TYPE_ID, LOADED_FROM_DATE, LOADED_TO_DATE, LOADED_DATE_OPERAND, CREATED_BY) VALUES ( #exportID#, #userID#, #userName#, #lastName#, #firstName#, #middleName#, #userEmail#, #itemTypeId#, #documentTypeId#, #loadedFromDate#, #loadedToDate#, #loadDateOperand#, #createdBy#) </insert> <delete id="deleteExportQueryByID" parameterClass="long"> DELETE FROM DMS_EXPORT_DOCS WHERE EXPORT_ID = #value# </delete> <select id="getExportSeq" resultClass="int"> select nextval('dms_export_seq') </select> </sqlMap> Please let me know if you need anyother iformation > Error after switching to postgres 8.0 while inserting to db > ----------------------------------------------------------- > > Key: IBATIS-86 > URL: http://issues.apache.org/jira/browse/IBATIS-86 > Project: iBatis for Java > Type: Bug > Components: SQL Maps > Environment: Windows xp, eclipse, java 1.4, dell inspiron 8200, postgres 8.0 > Reporter: knprince > > After switching the database to postgres 8.0(appropriate jdbc driver has been > placed), we are getting error while inserting to database, it looks like > becuase of confused data type by ibatis. for ex: for date column, and column > that is nullable etc. Following is the log while trying to insert in to a > table that has a varchar nullable and its value is null > com.ibatis.dao.client.DaoException: Failed to insert - id > [insertExportQuery], parameterObject [EMAIL PROTECTED] Cause: > com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred > in com/htcinc/dms/db/sqlmapdao/sql/Export.xml. --- The error occurred while > applying a parameter map. --- Check the insertExportQuery-InlineParameterMap. > --- Check the statement (update failed). --- Cause: java.sql.SQLException: > ERROR: column "loaded_from_date" is of type date but expression is of type > text Caused by: java.sql.SQLException: ERROR: column "loaded_from_date" is of > type date but expression is of type text Caused by: > com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred > in com/htcinc/dms/db/sqlmapdao/sql/Export.xml. --- The error occurred while > applying a parameter map. --- Check the insertExportQuery-InlineParameterMap. > --- Check the statement (update failed). --- Cause: java.sql.SQLException: > ERROR: column "loaded_from_date" is of type date but expression is of type > text Caused by: java.sql.SQLException: ERROR: column "loaded_from_date" is of > type date but expression is of type text at > com.ibatis.dao.client.template.SqlMapDaoTemplate.insert(SqlMapDaoTemplate.java:90) > at > com.htcinc.dms.db.sqlmapdao.ExportSqlMapDao.insertExportDocsQuery(ExportSqlMapDao.java:64) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) at > com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:61) at > $Proxy4.insertExportDocsQuery(Unknown Source) at > com.htcinc.dms.service.ExportDocsService.insertExportDocsQuery(ExportDocsService.java:65) > at -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira