ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juri Vrljicak <jurivrlji...@gmail.com>
Subject Problem with bit/boolean DataType
Date Tue, 07 Feb 2006 21:14:34 GMT
Hi there, please help on this. I am new to the list.
I am not able to make iBatis work on the following.
Ive got a domain bean with a property of type boolean which i am trying to
map to a column of type bit on postgres.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "
http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="Temporada">

<resultMap id="temporadaResult" class="ar.com.fys.almacen.domain.Temporada">
        <result property="temporadaId" column="ID"/>
    <result property="description" column="DESCRIPTION"/>
        <result property="activo" column="ACTIVE" />
</resultMap>

<resultMap id="idResult" class="ar.com.fys.almacen.domain.Temporada">
        <result property="temporadaId" column="ID"/>
</resultMap>

<parameterMap id="parameterMap" class="ar.com.fys.almacen.domain.Temporada">
  <parameter property="temporadaId" jdbcType="INT" javaType="int"/>
  <parameter property="description" jdbcType="VARCHAR" javaType="
java.lang.String"/>
  <parameter property="activo" jdbcType="BIT" javaType="boolean"
nullValue="0"/>
</parameterMap>

<select id="getAll.ar.com.fys.almacen.domain.Temporada.Results"
resultMap="temporadaResult">
    SELECT * FROM temporadas
</select>

<delete id="delete.ar.com.fys.almacen.domain.Temporada.Results"
parameterClass="ar.com.fys.almacen.domain.Temporada">
    delete from temporadas where id = #temporadaId#
</delete>

<insert id="insert.ar.com.fys.almacen.domain.Temporada.Results"
parameterClass="ar.com.fys.almacen.domain.Temporada">
        insert into Temporadas (id, description, active) values
(#temporadaId#,#description#,#activo:BIT#)
</insert>

<update id="update.ar.com.fys.almacen.domain.Temporada.Results"
parameterMap="parameterMap">
  update temporadas set description=#description#, active=#activo# where
id=#temporadaId#
</update>

<select id="getLastId.ar.com.fys.almacen.domain.Temporada.Results"
resultMap="idResult">
    SELECT max(id) as id from temporadas
</select>


</sqlMap>


I am aware of the type handlers but never used nor seen one before.
Here is the stack trace and my problem

org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad
SQL grammar []; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ar/com/fys/almacen/dao/ibatis/maps/Temporada.xml.

--- The error occurred while applying a parameter map.
--- Check the
insert.ar.com.fys.almacen.domain.Temporada.Results-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ERROR: column "active" is of type bit but
expression is of type boolean
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ar/com/fys/almacen/dao/ibatis/maps/Temporada.xml.

--- The error occurred while applying a parameter map.
--- Check the
insert.ar.com.fys.almacen.domain.Temporada.Results-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ERROR: column "active" is of type bit but
expression is of type boolean
Caused by: java.sql.SQLException: ERROR: column "active" is of type bit but
expression is of type boolean
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(
GeneralStatement.java:91)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(
SqlMapExecutorDelegate.java:442)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(
SqlMapSessionImpl.java:81)
    at
org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(
SqlMapClientTemplate.java:319)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(
SqlMapClientTemplate.java:181)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(
SqlMapClientTemplate.java:317)
    at
ar.com.fys.commons.dao.ormimpl.ibatis.IbatisObjectStorageManagerImpl.store(
IbatisObjectStorageManagerImpl.java:83)
    at ar.com.fys.almacen.client.ui.wizards.NewTemporadaWizard.onFinish(
NewTemporadaWizard.java:68)
    at org.springframework.richclient.wizard.AbstractWizard.performFinish(
AbstractWizard.java:275)
    at org.springframework.richclient.wizard.WizardDialog.onFinish(
WizardDialog.java:175)
    at
org.springframework.richclient.dialog.ApplicationDialog$1.doExecuteCommand(
ApplicationDialog.java:342)
    at org.springframework.richclient.command.ActionCommand.execute(
ActionCommand.java:188)
    at
org.springframework.richclient.command.ActionCommand$1.actionPerformed(
ActionCommand.java:123)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java
:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(
AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(
DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java
:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
BasicButtonListener.java:234)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java
:231)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java
:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1774)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:153)
    at java.awt.Dialog$1.run(Dialog.java:515)
    at java.awt.Dialog.show(Dialog.java:536)
    at java.awt.Component.show(Component.java:1300)
    at java.awt.Component.setVisible(Component.java:1253)
    at org.springframework.richclient.dialog.ApplicationDialog.showDialog(
ApplicationDialog.java:278)
    at ar.com.fys.almacen.client.ui.wizards.NewTemporadaWizard.execute(
NewTemporadaWizard.java:63)
    at
org.springframework.richclient.command.TargetableActionCommand.doExecuteCommand
(TargetableActionCommand.java:102)
    at org.springframework.richclient.command.ActionCommand.execute(
ActionCommand.java:188)
    at
org.springframework.richclient.command.ActionCommand$1.actionPerformed(
ActionCommand.java:123)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java
:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(
AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(
DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java
:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java
:1000)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(
BasicMenuItemUI.java:1041)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java
:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1774)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.sql.SQLException: ERROR: column "active" is of type bit but
expression is of type boolean
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
QueryExecutorImpl.java:1471)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(
QueryExecutorImpl.java:1256)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(
QueryExecutorImpl.java:175)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
AbstractJdbc2Statement.java:389)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
AbstractJdbc2Statement.java:330)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
AbstractJdbc2Statement.java:321)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(
DelegatingPreparedStatement.java:168)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(
SqlExecutor.java:84)
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate
(GeneralStatement.java:200)
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(
GeneralStatement.java:78)
    ... 70 more

Caused by:
java.sql.SQLException: ERROR: column "active" is of type bit but expression
is of type boolean
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
QueryExecutorImpl.java:1471)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(
QueryExecutorImpl.java:1256)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(
QueryExecutorImpl.java:175)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
AbstractJdbc2Statement.java:389)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
AbstractJdbc2Statement.java:330)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
AbstractJdbc2Statement.java:321)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(
DelegatingPreparedStatement.java:168)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(
SqlExecutor.java:84)
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate
(GeneralStatement.java:200)
    at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(
GeneralStatement.java:78)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(
SqlMapExecutorDelegate.java:442)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(
SqlMapSessionImpl.java:81)
    at
org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(
SqlMapClientTemplate.java:319)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(
SqlMapClientTemplate.java:181)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(
SqlMapClientTemplate.java:317)
    at
ar.com.fys.commons.dao.ormimpl.ibatis.IbatisObjectStorageManagerImpl.store(
IbatisObjectStorageManagerImpl.java:83)
    at ar.com.fys.almacen.client.ui.wizards.NewTemporadaWizard.onFinish(
NewTemporadaWizard.java:68)
    at org.springframework.richclient.wizard.AbstractWizard.performFinish(
AbstractWizard.java:275)
    at org.springframework.richclient.wizard.WizardDialog.onFinish(
WizardDialog.java:175)
    at
org.springframework.richclient.dialog.ApplicationDialog$1.doExecuteCommand(
ApplicationDialog.java:342)
    at org.springframework.richclient.command.ActionCommand.execute(
ActionCommand.java:188)
    at
org.springframework.richclient.command.ActionCommand$1.actionPerformed(
ActionCommand.java:123)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java
:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(
AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(
DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java
:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
BasicButtonListener.java:234)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java
:231)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java
:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1774)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:153)
    at java.awt.Dialog$1.run(Dialog.java:515)
    at java.awt.Dialog.show(Dialog.java:536)
    at java.awt.Component.show(Component.java:1300)
    at java.awt.Component.setVisible(Component.java:1253)
    at org.springframework.richclient.dialog.ApplicationDialog.showDialog(
ApplicationDialog.java:278)
    at ar.com.fys.almacen.client.ui.wizards.NewTemporadaWizard.execute(
NewTemporadaWizard.java:63)
    at
org.springframework.richclient.command.TargetableActionCommand.doExecuteCommand
(TargetableActionCommand.java:102)
    at org.springframework.richclient.command.ActionCommand.execute(
ActionCommand.java:188)
    at
org.springframework.richclient.command.ActionCommand$1.actionPerformed(
ActionCommand.java:123)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java
:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(
AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(
DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java
:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java
:1000)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(
BasicMenuItemUI.java:1041)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java
:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1774)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


hope this is clear enough,

best regards
juri vrljicak

Mime
View raw message