• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need some Ibatis help

 
Akshay Bondre
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using Ibatis to fire queries to DB2. Server is Websphere 7.0.0.9

I have a field which has to be converted in bytes and inserted into a CHARACTER column whose length is 16.

In the code I do the following,

String str = "123";
str = str.getBytes().toString();

I set this "str" in one of the objects which are mapped in the "sql.xml" file.

My mapping for this particular field is as follows :

parameter property="idOper" jdbcType="CHARACTER" javaType="java.lang.String";

Now, when I execute the code, it runs fine for the first time, but when I run it one more time, it gives me an exception that it is not able to convert String into byte[].

The exception block is as follows :


Convert invalid: Unable to convert from "java.lang.String" to "byte []" ErrorCode =- 4474, SQLSTATE = null; com.ibatis.common.jdbc.exception.NestedSQLException nested exception is:


Any help, pointers, observations would be much appreciated.

Thanks,
akkyy
 
Akshay Bondre
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, anyone?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please remember that PatienceIsAVirtue. We are all volunteers and you're asking a very technical question that not many people can answer. So it may take a while.
 
Akshay Bondre
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ Wouter Oet :

Ok, I just thought of bouncing this topic so that it is seen by someone who may be able to suggest something.

Thanks.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you consider the possibility that the Character filed value either in database or in your code can be null?
 
Akshay Bondre
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Kumarr wrote:Did you consider the possibility that the Character filed value either in database or in your code can be null?


Yes, I checked the values just before the DTO is passed to "getSqlMapClientTemplate().insert", and the value is always there.

To top it all, it works fine when the same EAR is deployed on JBoss instead od websphere, pointing to same database in either case,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic