ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tamilselvan Radha Krishnan" <Tamilselvan.RadhaKrish...@igate.com>
Subject RE: YesNoTypeHandler - create problem in parameterMap
Date Sun, 19 Nov 2006 06:12:50 GMT
Hi Niels,

It's perfectly working.  Thanks for the information.

 

Regards, 

Tamil



From: Niels Beekman [mailto:n.beekman@wis.nl] 
Sent: Saturday, November 18, 2006 7:35 PM
To: user-java@ibatis.apache.org
Subject: RE: YesNoTypeHandler - create problem in parameterMap

 

If you are using a ParameterMap to specify parameters, you should use
the ?-syntax:

 

WHERE IS_DELETED = ?

 

You can also use the inline syntax, which is a lot clearer most of the
times:

 

WHERE IS_DELETED =
#isDeleted,handler=com.ge.cf.persistence.YesNoBooleanTypeHandler#

 

Tip: handlers that you use frequently can be aliased (global in the
config-file):

 

<typeAlias alias="YesNoBooleanHandler"
type="com.ge.cf.persistence.YesNoBooleanTypeHandler"/>

 

then you can do the following:

 

- <parameter property="isDeleted" typeHandler="YesNoBooleanHandler"/>

- <result property="isDeleted" column="IS_DELETED"
typeHandler="YesNoBooleanHandler"/>

- #isDeleted,handler=YesNoBooleanHandler#

 

Note that specifying jdbcType is not required, this is handled by the
type handler (using getString() and setString()).

 

HTH,

 

Niels

________________________________

From: Tamilselvan Radha Krishnan
[mailto:Tamilselvan.RadhaKrishnan@igate.com] 
Sent: zaterdag 18 november 2006 7:12
To: user-java@ibatis.apache.org
Subject: YesNoTypeHandler - create problem in parameterMap

 

Hi,

I'm trying to use the YesNoBooleanTypeHandler conversion between java
boolean to jdbc CHAR (Y or N) vice versa.

I can able to retrieve the boolean values (isDeleted) into my POJO
class.  But when I do select query  using 'isDeleted', then it throws
the below exception:

Can you help me where I'm missing.

inside TestSqlMapDao.getDepartments( boolean isDeleted)...

Exception in thread "main" com.ibatis.dao.client.DaoException: Failed to
queryForList - id [Dept.getDepartmentsDeleted], parameterObject
[com.ge.cf.myaccounts.domain.Department@860d49].  Cause:
com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred in com/ge/cf/persistence/sqlmapdao/Dept.xml.  

--- The error occurred while applying a parameter map.  

--- Check the Dept.deptParam.  

--- Check the statement (query failed).  

--- Cause: java.sql.SQLException: ORA-00911: invalid character

Caused by: java.sql.SQLException: ORA-00911: invalid character

        at
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoT
emplate.java:284)

 

    <parameterMap id="deptParam" class="deptObj">       

       <parameter   property="isDeleted"
typeHandler="com.ge.cf.persistence.YesNoBooleanTypeHandler"
javaType="boolean"    

                         jdbcType="VARCHAR" nullValue="N" />

    </parameterMap> 

  <resultMap id="deptResult" class="deptObj">

        <result property="llDeptNo" column="DEPTNO"/>

        <result property="deptName" column="DNAME"/>

        <result property="loc" column="LOC"/>

        <result property="sectionId" column="SECTIONID"  nullValue="0"/>

        <result property="isDeleted" column="IS_DELETED"
typeHandler="com.ge.cf.persistence.YesNoBooleanTypeHandler" />

        

    </resultMap>

        

   <select id="getDepartmentsDeleted" resultMap="deptResult"
parameterMap="deptParam">

    SELECT                      

          DEPTNO ,

          DNAME  ,

          LOC    ,

          SECTIONID ,

          IS_DELETED

    FROM DEPT    

    WHERE IS_DELETED = #isDeleted#

    

  </select>

My POJO class

  Public class Department

        private long deptNo;

        private String deptName;

        private String loc;

        private int sectionId;

        private boolean isDeleted;

Regards,

Tamil

 


_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Information transmitted by this EMAIL is proprietary to iGATE Group of
Companies and is intended for use only by the individual 
or entity to whom it is addressed and may contain information that is
privileged, confidential, or exempt from disclosure under 
applicable law. If you are not the intended recipient of this EMAIL
immediately notify the sender at iGATE or mailadmin@igate.com 
and delete this EMAIL including any attachments
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended
for use only by the individual 
or entity to whom it is addressed and may contain information that is privileged, confidential,
or exempt from disclosure under 
applicable law. If you are not the intended recipient of this EMAIL immediately notify the
sender at iGATE or mailadmin@igate.com 
and delete this EMAIL including any attachments
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Mime
View raw message