You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Cax <ca...@gmail.com> on 2009/07/07 12:10:10 UTC

String parameter problem

hello, I got a problem in iBatis, i hope somebody could help me...
i hit problem when i pass in a parameter which the data type is string, and
the field length in database is 19 char. But,it throws exception because the
returned object is null. and then i try to change the WHERE clause
condition,to based on other field which the data type is number,and it
works...
i want to know what is the problem,is the string value too long or what?

below is my code example :

<select id="selectAccountById" parameterClass="Account"
resultClass="Account">
    select
      PX_IR025_PAN as pan,
      F9_IR025_CRN as CRN,
      FX_IR025_EMB_NAME as name,
      FX_IR025_CRD_PGM as crdPgm,
      FX_IR025_UPD_UID as updId 
    from IR025
    where PX_IR025_PAN = #pan#  
</select>


in java:

Account acc = new Account();

acc.setpan("1234567890123456");

acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);  
//(Note : return null)
System.out.println("  " + acc.getname());


Thanks before for your help....:-)



-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: AW: String parameter problem

Posted by Cax <ca...@gmail.com>.
yes,i solve the problem..Thx


Andrey Rogov-3 wrote:
> 
> do you solve problem ?
> 
> 2009/7/23, Cax <ca...@gmail.com>:
>>
>> Finally,i know what is the problem...that is because of the declared
>> length
>> of PX_IR025_PAN in database is 19 CHAR..but the data is only contain 16
>> CHAR...that's why I can't get the result,so I should put a TRIM in the
>> query
>> to remove the last 3 CHAR..like this :
>>
>> select
>>       F9_IR025_CRN as CRN,
>>       FX_IR025_EMB_NAME as name,
>>       FX_IR025_CRD_PGM as crdPgm,
>>       FX_IR025_UPD_UID as updId
>>     from IR025
>>     where TRIM(PX_IR025_PAN) = #pan#
>>
>> and it's working now...
>> Thanks for all of your suggestions to help me...:-)
>>
>>
>> Andrey Rogov-2 wrote:
>>>
>>> mail me DDL table properties and IR025data .
>>>
>>> 2009/7/10 Cax <ca...@gmail.com>
>>>
>>>>
>>>> I use Oracle database.
>>>>
>>>>
>>>> Sergey Livanov-2 wrote:
>>>> >
>>>> > What database do you use ?
>>>> >
>>>> > 2009/7/9 Cax <ca...@gmail.com>
>>>> >
>>>> >>
>>>> >> i try to change the sql not to get the parameter, like this :
>>>> >>
>>>> >> select
>>>> >>      PX_IR025_PAN as pan,
>>>> >>      F9_IR025_CRN as CRN,
>>>> >>      FX_IR025_EMB_NAME as name,
>>>> >>      FX_IR025_CRD_PGM as crdPgm,
>>>> >>      FX_IR025_UPD_UID as updId
>>>> >>    from IR025
>>>> >>     where PX_IR025_PAN = '1234567890123456'
>>>> >>
>>>> >> and it works....
>>>> >>
>>>> >>
>>>> >> Andrey Rogov-2 wrote:
>>>> >> >
>>>> >> > hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
>>>> >> > try to solve this problem with external sql runner, then copy sql
>>>> >> > to xml files.
>>>> >> >
>>>> >> >
>>>> >> > 2009/7/9 Cax <ca...@gmail.com>
>>>> >> >
>>>> >> >>
>>>> >> >> Hi Benjamin,i'd tried this way before also...but it still hit the
>>>> same
>>>> >> >> problem... :(
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> Benjamin-Klatt wrote:
>>>> >> >> >
>>>> >> >> > No there should not be any limitation that you will have to
>>>> worry
>>>> >> >> about.
>>>> >> >> > What data type do you use in the database for the PX_IR025_PAN
>>>> >> field?
>>>> >> >> >
>>>> >> >> > Can you try to explicitly define your sql data type in the
>>>> query?
>>>> >> >> > Like: where PX_IR025_PAN = #pan:VARCHAR#
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >> > -----Ursprüngliche Nachricht-----
>>>> >> >> > Von: Cax [mailto:cahyadihermanto@gmail.com]
>>>> >> >> > Gesendet: Mittwoch, 8. Juli 2009 19:08
>>>> >> >> > An: user-java@ibatis.apache.org
>>>> >> >> > Betreff: Re: AW: String parameter problem
>>>> >> >> >
>>>> >> >> >
>>>> >> >> > yes,of course.there is a record which match the query. When i
>>>> try
>>>> to
>>>> >> >> > change
>>>> >> >> > the data type to Long,it works.but if String,return null value.
>>>> And
>>>> >> >> > then,when i change the WHERE clause condition,to based on other
>>>> >> field
>>>> >> >> > which
>>>> >> >> > the data type is String also like this :
>>>> >> >> >
>>>> >> >> > select
>>>> >> >> >       PX_IR025_PAN as pan,
>>>> >> >> >       F9_IR025_CRN as CRN,
>>>> >> >> >       FX_IR025_EMB_NAME as name,
>>>> >> >> >       FX_IR025_CRD_PGM as crdPgm,
>>>> >> >> >       FX_IR025_UPD_UID as updId
>>>> >> >> >     from IR025
>>>> >> >> >     where FX_IR025_UPD_UID = #updId#
>>>> >> >> >
>>>> >> >> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8
>>>> char
>>>> >> >> > only...is
>>>> >> >> > there any length limitation for String data type?
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >> > Benjamin-Klatt wrote:
>>>> >> >> >>
>>>> >> >> >> Hi cax,
>>>> >> >> >>
>>>> >> >> >> have you tried to execute the query directly on the database
>>>> to
>>>> >> ensure
>>>> >> >> >> there
>>>> >> >> >> is a result for your query?
>>>> >> >> >>
>>>> >> >> >> br
>>>> >> >> >> Benjamin
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> -----Ursprüngliche Nachricht-----
>>>> >> >> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
>>>> >> >> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
>>>> >> >> >> An: user-java@ibatis.apache.org
>>>> >> >> >> Betreff: Re: String parameter problem
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> Hi,i turn on Log4j,but i can't see what is the problem in the
>>>> log
>>>> >> >> >> file..here
>>>> >> >> >> is the result in the log file :
>>>> >> >> >>
>>>> >> >> >> 2009-07-08 21:59:12,422 DEBUG main
>>>> >> >> >> com.ibatis.common.jdbc.SimpleDataSource
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> Created
>>>> >> >> >> connection 35293.
>>>> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> >> >> {conn-100000}
>>>> >> >> >> Connection
>>>> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> >> >> {conn-100000}
>>>> >> >> >> Preparing Statement:      select       PX_IR025_PAN as pan,
>>>> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>>>> >> >> >> FX_IR025_CRD_PGM
>>>> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
>>>> >> where
>>>> >> >> >> PX_IR025_PAN = ?
>>>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> >> >> {pstm-100001}
>>>> >> >> >> Executing Statement:      select       PX_IR025_PAN as pan,
>>>> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>>>> >> >> >> FX_IR025_CRD_PGM
>>>> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
>>>> >> where
>>>> >> >> >> PX_IR025_PAN = ?
>>>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> >> >> {pstm-100001}
>>>> >> >> >> Parameters: [1234567890123456]
>>>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> >> >> {pstm-100001}
>>>> >> >> >> Types: [java.lang.String]
>>>> >> >> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
>>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>>> >> >> >> {rset-100002}
>>>> >> >> >> ResultSet
>>>> >> >> >> 2009-07-08 22:08:43,805 ERROR main
>>>> ibatis.com.mydomain.data.Main
>>>> >> >> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> Andrey Rogov-2 wrote:
>>>> >> >> >>>
>>>> >> >> >>> hi ,
>>>> >> >> >>> turn on Log4j and look at the sql statement, prepare,
>>>> parameter
>>>> >> and
>>>> >> >> >>> query
>>>> >> >> >>> result .
>>>> >> >> >>>
>>>> >> >> >>>
>>>> >> >> >>>
>>>> >> >> >>> 2009/7/7 Cax <ca...@gmail.com>
>>>> >> >> >>>
>>>> >> >> >>>>
>>>> >> >> >>>> hello, I got a problem in iBatis, i hope somebody could help
>>>> >> me...
>>>> >> >> >>>> i hit problem when i pass in a parameter which the data type
>>>> is
>>>> >> >> string,
>>>> >> >> >>>> and
>>>> >> >> >>>> the field length in database is 19 char. But,it throws
>>>> exception
>>>> >> >> >>>> because
>>>> >> >> >>>> the
>>>> >> >> >>>> returned object is null. and then i try to change the WHERE
>>>> >> clause
>>>> >> >> >>>> condition,to based on other field which the data type is
>>>> >> number,and
>>>> >> >> it
>>>> >> >> >>>> works...
>>>> >> >> >>>> i want to know what is the problem,is the string value too
>>>> long
>>>> >> or
>>>> >> >> >>>> what?
>>>> >> >> >>>>
>>>> >> >> >>>> below is my code example :
>>>> >> >> >>>>
>>>> >> >> >>>> <select id="selectAccountById" parameterClass="Account"
>>>> >> >> >>>> resultClass="Account">
>>>> >> >> >>>>    select
>>>> >> >> >>>>      PX_IR025_PAN as pan,
>>>> >> >> >>>>      F9_IR025_CRN as CRN,
>>>> >> >> >>>>      FX_IR025_EMB_NAME as name,
>>>> >> >> >>>>      FX_IR025_CRD_PGM as crdPgm,
>>>> >> >> >>>>      FX_IR025_UPD_UID as updId
>>>> >> >> >>>>    from IR025
>>>> >> >> >>>>    where PX_IR025_PAN = #pan#
>>>> >> >> >>>> </select>
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >> >>>> in java:
>>>> >> >> >>>>
>>>> >> >> >>>> Account acc = new Account();
>>>> >> >> >>>>
>>>> >> >> >>>> acc.setpan("1234567890123456");
>>>> >> >> >>>>
>>>> >> >> >>>> acc = (Account)
>>>> sqlMapper.queryForObject("selectAccountById",
>>>> >> acc);
>>>> >> >> >>>> //(Note : return null)
>>>> >> >> >>>> System.out.println("  " + acc.getname());
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >> >>>> Thanks before for your help....:-)
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >> >>>> --
>>>> >> >> >>>> View this message in context:
>>>> >> >> >>>>
>>>> >> >>
>>>> >>
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>>>> >> >> >>>> Sent from the iBATIS - User - Java mailing list archive at
>>>> >> >> Nabble.com.
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >>
>>>> ---------------------------------------------------------------------
>>>> >> >> >>>> To unsubscribe, e-mail:
>>>> user-java-unsubscribe@ibatis.apache.org
>>>> >> >> >>>> For additional commands, e-mail:
>>>> user-java-help@ibatis.apache.org
>>>> >> >> >>>>
>>>> >> >> >>>>
>>>> >> >> >>>
>>>> >> >> >>>
>>>> >> >> >>
>>>> >> >> >> --
>>>> >> >> >> View this message in context:
>>>> >> >> >>
>>>> >> >>
>>>> >>
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
>>>> >> >> >> Sent from the iBATIS - User - Java mailing list archive at
>>>> >> Nabble.com.
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> >> >> To unsubscribe, e-mail:
>>>> user-java-unsubscribe@ibatis.apache.org
>>>> >> >> >> For additional commands, e-mail:
>>>> user-java-help@ibatis.apache.org
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> >> >> To unsubscribe, e-mail:
>>>> user-java-unsubscribe@ibatis.apache.org
>>>> >> >> >> For additional commands, e-mail:
>>>> user-java-help@ibatis.apache.org
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >
>>>> >> >> > --
>>>> >> >> > View this message in context:
>>>> >> >> >
>>>> >>
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
>>>> >> >> > Sent from the iBATIS - User - Java mailing list archive at
>>>> >> Nabble.com.
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> >> >> > For additional commands, e-mail:
>>>> user-java-help@ibatis.apache.org
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> >> >> > For additional commands, e-mail:
>>>> user-java-help@ibatis.apache.org
>>>> >> >> >
>>>> >> >> >
>>>> >> >> >
>>>> >> >>
>>>> >> >> --
>>>> >> >> View this message in context:
>>>> >> >>
>>>> >>
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
>>>> >> >> Sent from the iBATIS - User - Java mailing list archive at
>>>> Nabble.com.
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> ---------------------------------------------------------------------
>>>> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>> >> >>
>>>> >> >>
>>>> >> >
>>>> >> >
>>>> >>
>>>> >> --
>>>> >> View this message in context:
>>>> >>
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
>>>> >> Sent from the iBATIS - User - Java mailing list archive at
>>>> Nabble.com.
>>>> >>
>>>> >>
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>> >>
>>>> >>
>>>> >
>>>> >
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24419592.html
>>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24619051.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24622698.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: AW: String parameter problem

Posted by Andrey Rogov <ko...@gmail.com>.
do you solve problem ?

2009/7/23, Cax <ca...@gmail.com>:
>
> Finally,i know what is the problem...that is because of the declared length
> of PX_IR025_PAN in database is 19 CHAR..but the data is only contain 16
> CHAR...that's why I can't get the result,so I should put a TRIM in the query
> to remove the last 3 CHAR..like this :
>
> select
>       F9_IR025_CRN as CRN,
>       FX_IR025_EMB_NAME as name,
>       FX_IR025_CRD_PGM as crdPgm,
>       FX_IR025_UPD_UID as updId
>     from IR025
>     where TRIM(PX_IR025_PAN) = #pan#
>
> and it's working now...
> Thanks for all of your suggestions to help me...:-)
>
>
> Andrey Rogov-2 wrote:
>>
>> mail me DDL table properties and IR025data .
>>
>> 2009/7/10 Cax <ca...@gmail.com>
>>
>>>
>>> I use Oracle database.
>>>
>>>
>>> Sergey Livanov-2 wrote:
>>> >
>>> > What database do you use ?
>>> >
>>> > 2009/7/9 Cax <ca...@gmail.com>
>>> >
>>> >>
>>> >> i try to change the sql not to get the parameter, like this :
>>> >>
>>> >> select
>>> >>      PX_IR025_PAN as pan,
>>> >>      F9_IR025_CRN as CRN,
>>> >>      FX_IR025_EMB_NAME as name,
>>> >>      FX_IR025_CRD_PGM as crdPgm,
>>> >>      FX_IR025_UPD_UID as updId
>>> >>    from IR025
>>> >>     where PX_IR025_PAN = '1234567890123456'
>>> >>
>>> >> and it works....
>>> >>
>>> >>
>>> >> Andrey Rogov-2 wrote:
>>> >> >
>>> >> > hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
>>> >> > try to solve this problem with external sql runner, then copy sql
>>> >> > to xml files.
>>> >> >
>>> >> >
>>> >> > 2009/7/9 Cax <ca...@gmail.com>
>>> >> >
>>> >> >>
>>> >> >> Hi Benjamin,i'd tried this way before also...but it still hit the
>>> same
>>> >> >> problem... :(
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> Benjamin-Klatt wrote:
>>> >> >> >
>>> >> >> > No there should not be any limitation that you will have to worry
>>> >> >> about.
>>> >> >> > What data type do you use in the database for the PX_IR025_PAN
>>> >> field?
>>> >> >> >
>>> >> >> > Can you try to explicitly define your sql data type in the query?
>>> >> >> > Like: where PX_IR025_PAN = #pan:VARCHAR#
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> > -----Ursprüngliche Nachricht-----
>>> >> >> > Von: Cax [mailto:cahyadihermanto@gmail.com]
>>> >> >> > Gesendet: Mittwoch, 8. Juli 2009 19:08
>>> >> >> > An: user-java@ibatis.apache.org
>>> >> >> > Betreff: Re: AW: String parameter problem
>>> >> >> >
>>> >> >> >
>>> >> >> > yes,of course.there is a record which match the query. When i try
>>> to
>>> >> >> > change
>>> >> >> > the data type to Long,it works.but if String,return null value.
>>> And
>>> >> >> > then,when i change the WHERE clause condition,to based on other
>>> >> field
>>> >> >> > which
>>> >> >> > the data type is String also like this :
>>> >> >> >
>>> >> >> > select
>>> >> >> >       PX_IR025_PAN as pan,
>>> >> >> >       F9_IR025_CRN as CRN,
>>> >> >> >       FX_IR025_EMB_NAME as name,
>>> >> >> >       FX_IR025_CRD_PGM as crdPgm,
>>> >> >> >       FX_IR025_UPD_UID as updId
>>> >> >> >     from IR025
>>> >> >> >     where FX_IR025_UPD_UID = #updId#
>>> >> >> >
>>> >> >> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8
>>> char
>>> >> >> > only...is
>>> >> >> > there any length limitation for String data type?
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> > Benjamin-Klatt wrote:
>>> >> >> >>
>>> >> >> >> Hi cax,
>>> >> >> >>
>>> >> >> >> have you tried to execute the query directly on the database to
>>> >> ensure
>>> >> >> >> there
>>> >> >> >> is a result for your query?
>>> >> >> >>
>>> >> >> >> br
>>> >> >> >> Benjamin
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> -----Ursprüngliche Nachricht-----
>>> >> >> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
>>> >> >> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
>>> >> >> >> An: user-java@ibatis.apache.org
>>> >> >> >> Betreff: Re: String parameter problem
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> Hi,i turn on Log4j,but i can't see what is the problem in the
>>> log
>>> >> >> >> file..here
>>> >> >> >> is the result in the log file :
>>> >> >> >>
>>> >> >> >> 2009-07-08 21:59:12,422 DEBUG main
>>> >> >> >> com.ibatis.common.jdbc.SimpleDataSource
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> Created
>>> >> >> >> connection 35293.
>>> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> >> >> {conn-100000}
>>> >> >> >> Connection
>>> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> >> >> {conn-100000}
>>> >> >> >> Preparing Statement:      select       PX_IR025_PAN as pan,
>>> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>>> >> >> >> FX_IR025_CRD_PGM
>>> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
>>> >> where
>>> >> >> >> PX_IR025_PAN = ?
>>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> >> >> {pstm-100001}
>>> >> >> >> Executing Statement:      select       PX_IR025_PAN as pan,
>>> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>>> >> >> >> FX_IR025_CRD_PGM
>>> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
>>> >> where
>>> >> >> >> PX_IR025_PAN = ?
>>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> >> >> {pstm-100001}
>>> >> >> >> Parameters: [1234567890123456]
>>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> >> >> {pstm-100001}
>>> >> >> >> Types: [java.lang.String]
>>> >> >> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
>>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>>> >> >> >> {rset-100002}
>>> >> >> >> ResultSet
>>> >> >> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
>>> >> >> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> Andrey Rogov-2 wrote:
>>> >> >> >>>
>>> >> >> >>> hi ,
>>> >> >> >>> turn on Log4j and look at the sql statement, prepare, parameter
>>> >> and
>>> >> >> >>> query
>>> >> >> >>> result .
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>> 2009/7/7 Cax <ca...@gmail.com>
>>> >> >> >>>
>>> >> >> >>>>
>>> >> >> >>>> hello, I got a problem in iBatis, i hope somebody could help
>>> >> me...
>>> >> >> >>>> i hit problem when i pass in a parameter which the data type
>>> is
>>> >> >> string,
>>> >> >> >>>> and
>>> >> >> >>>> the field length in database is 19 char. But,it throws
>>> exception
>>> >> >> >>>> because
>>> >> >> >>>> the
>>> >> >> >>>> returned object is null. and then i try to change the WHERE
>>> >> clause
>>> >> >> >>>> condition,to based on other field which the data type is
>>> >> number,and
>>> >> >> it
>>> >> >> >>>> works...
>>> >> >> >>>> i want to know what is the problem,is the string value too
>>> long
>>> >> or
>>> >> >> >>>> what?
>>> >> >> >>>>
>>> >> >> >>>> below is my code example :
>>> >> >> >>>>
>>> >> >> >>>> <select id="selectAccountById" parameterClass="Account"
>>> >> >> >>>> resultClass="Account">
>>> >> >> >>>>    select
>>> >> >> >>>>      PX_IR025_PAN as pan,
>>> >> >> >>>>      F9_IR025_CRN as CRN,
>>> >> >> >>>>      FX_IR025_EMB_NAME as name,
>>> >> >> >>>>      FX_IR025_CRD_PGM as crdPgm,
>>> >> >> >>>>      FX_IR025_UPD_UID as updId
>>> >> >> >>>>    from IR025
>>> >> >> >>>>    where PX_IR025_PAN = #pan#
>>> >> >> >>>> </select>
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>> in java:
>>> >> >> >>>>
>>> >> >> >>>> Account acc = new Account();
>>> >> >> >>>>
>>> >> >> >>>> acc.setpan("1234567890123456");
>>> >> >> >>>>
>>> >> >> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById",
>>> >> acc);
>>> >> >> >>>> //(Note : return null)
>>> >> >> >>>> System.out.println("  " + acc.getname());
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>> Thanks before for your help....:-)
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>> --
>>> >> >> >>>> View this message in context:
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>>> >> >> >>>> Sent from the iBATIS - User - Java mailing list archive at
>>> >> >> Nabble.com.
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >>
>>> ---------------------------------------------------------------------
>>> >> >> >>>> To unsubscribe, e-mail:
>>> user-java-unsubscribe@ibatis.apache.org
>>> >> >> >>>> For additional commands, e-mail:
>>> user-java-help@ibatis.apache.org
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >> View this message in context:
>>> >> >> >>
>>> >> >>
>>> >>
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
>>> >> >> >> Sent from the iBATIS - User - Java mailing list archive at
>>> >> Nabble.com.
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> ---------------------------------------------------------------------
>>> >> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> >> >> For additional commands, e-mail:
>>> user-java-help@ibatis.apache.org
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> ---------------------------------------------------------------------
>>> >> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> >> >> For additional commands, e-mail:
>>> user-java-help@ibatis.apache.org
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >
>>> >> >> > --
>>> >> >> > View this message in context:
>>> >> >> >
>>> >>
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
>>> >> >> > Sent from the iBATIS - User - Java mailing list archive at
>>> >> Nabble.com.
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> ---------------------------------------------------------------------
>>> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> ---------------------------------------------------------------------
>>> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >> --
>>> >> >> View this message in context:
>>> >> >>
>>> >>
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
>>> >> >> Sent from the iBATIS - User - Java mailing list archive at
>>> Nabble.com.
>>> >> >>
>>> >> >>
>>> >> >>
>>> ---------------------------------------------------------------------
>>> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
>>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >>
>>> >>
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24419592.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24619051.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: AW: String parameter problem

Posted by Cax <ca...@gmail.com>.
Finally,i know what is the problem...that is because of the declared length
of PX_IR025_PAN in database is 19 CHAR..but the data is only contain 16
CHAR...that's why I can't get the result,so I should put a TRIM in the query
to remove the last 3 CHAR..like this :

select
      F9_IR025_CRN as CRN,
      FX_IR025_EMB_NAME as name,
      FX_IR025_CRD_PGM as crdPgm,
      FX_IR025_UPD_UID as updId
    from IR025
    where TRIM(PX_IR025_PAN) = #pan#

and it's working now...
Thanks for all of your suggestions to help me...:-)


Andrey Rogov-2 wrote:
> 
> mail me DDL table properties and IR025data .
> 
> 2009/7/10 Cax <ca...@gmail.com>
> 
>>
>> I use Oracle database.
>>
>>
>> Sergey Livanov-2 wrote:
>> >
>> > What database do you use ?
>> >
>> > 2009/7/9 Cax <ca...@gmail.com>
>> >
>> >>
>> >> i try to change the sql not to get the parameter, like this :
>> >>
>> >> select
>> >>      PX_IR025_PAN as pan,
>> >>      F9_IR025_CRN as CRN,
>> >>      FX_IR025_EMB_NAME as name,
>> >>      FX_IR025_CRD_PGM as crdPgm,
>> >>      FX_IR025_UPD_UID as updId
>> >>    from IR025
>> >>     where PX_IR025_PAN = '1234567890123456'
>> >>
>> >> and it works....
>> >>
>> >>
>> >> Andrey Rogov-2 wrote:
>> >> >
>> >> > hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
>> >> > try to solve this problem with external sql runner, then copy sql
>> >> > to xml files.
>> >> >
>> >> >
>> >> > 2009/7/9 Cax <ca...@gmail.com>
>> >> >
>> >> >>
>> >> >> Hi Benjamin,i'd tried this way before also...but it still hit the
>> same
>> >> >> problem... :(
>> >> >>
>> >> >>
>> >> >>
>> >> >> Benjamin-Klatt wrote:
>> >> >> >
>> >> >> > No there should not be any limitation that you will have to worry
>> >> >> about.
>> >> >> > What data type do you use in the database for the PX_IR025_PAN
>> >> field?
>> >> >> >
>> >> >> > Can you try to explicitly define your sql data type in the query?
>> >> >> > Like: where PX_IR025_PAN = #pan:VARCHAR#
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > -----Ursprüngliche Nachricht-----
>> >> >> > Von: Cax [mailto:cahyadihermanto@gmail.com]
>> >> >> > Gesendet: Mittwoch, 8. Juli 2009 19:08
>> >> >> > An: user-java@ibatis.apache.org
>> >> >> > Betreff: Re: AW: String parameter problem
>> >> >> >
>> >> >> >
>> >> >> > yes,of course.there is a record which match the query. When i try
>> to
>> >> >> > change
>> >> >> > the data type to Long,it works.but if String,return null value.
>> And
>> >> >> > then,when i change the WHERE clause condition,to based on other
>> >> field
>> >> >> > which
>> >> >> > the data type is String also like this :
>> >> >> >
>> >> >> > select
>> >> >> >       PX_IR025_PAN as pan,
>> >> >> >       F9_IR025_CRN as CRN,
>> >> >> >       FX_IR025_EMB_NAME as name,
>> >> >> >       FX_IR025_CRD_PGM as crdPgm,
>> >> >> >       FX_IR025_UPD_UID as updId
>> >> >> >     from IR025
>> >> >> >     where FX_IR025_UPD_UID = #updId#
>> >> >> >
>> >> >> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8
>> char
>> >> >> > only...is
>> >> >> > there any length limitation for String data type?
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > Benjamin-Klatt wrote:
>> >> >> >>
>> >> >> >> Hi cax,
>> >> >> >>
>> >> >> >> have you tried to execute the query directly on the database to
>> >> ensure
>> >> >> >> there
>> >> >> >> is a result for your query?
>> >> >> >>
>> >> >> >> br
>> >> >> >> Benjamin
>> >> >> >>
>> >> >> >>
>> >> >> >> -----Ursprüngliche Nachricht-----
>> >> >> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
>> >> >> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
>> >> >> >> An: user-java@ibatis.apache.org
>> >> >> >> Betreff: Re: String parameter problem
>> >> >> >>
>> >> >> >>
>> >> >> >> Hi,i turn on Log4j,but i can't see what is the problem in the
>> log
>> >> >> >> file..here
>> >> >> >> is the result in the log file :
>> >> >> >>
>> >> >> >> 2009-07-08 21:59:12,422 DEBUG main
>> >> >> >> com.ibatis.common.jdbc.SimpleDataSource
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> Created
>> >> >> >> connection 35293.
>> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> >> {conn-100000}
>> >> >> >> Connection
>> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> >> {conn-100000}
>> >> >> >> Preparing Statement:      select       PX_IR025_PAN as pan,
>> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>> >> >> >> FX_IR025_CRD_PGM
>> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
>> >> where
>> >> >> >> PX_IR025_PAN = ?
>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> >> {pstm-100001}
>> >> >> >> Executing Statement:      select       PX_IR025_PAN as pan,
>> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>> >> >> >> FX_IR025_CRD_PGM
>> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
>> >> where
>> >> >> >> PX_IR025_PAN = ?
>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> >> {pstm-100001}
>> >> >> >> Parameters: [1234567890123456]
>> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> >> {pstm-100001}
>> >> >> >> Types: [java.lang.String]
>> >> >> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
>> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> >> {rset-100002}
>> >> >> >> ResultSet
>> >> >> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
>> >> >> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
>> >> >> >>
>> >> >> >>
>> >> >> >> Andrey Rogov-2 wrote:
>> >> >> >>>
>> >> >> >>> hi ,
>> >> >> >>> turn on Log4j and look at the sql statement, prepare, parameter
>> >> and
>> >> >> >>> query
>> >> >> >>> result .
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> 2009/7/7 Cax <ca...@gmail.com>
>> >> >> >>>
>> >> >> >>>>
>> >> >> >>>> hello, I got a problem in iBatis, i hope somebody could help
>> >> me...
>> >> >> >>>> i hit problem when i pass in a parameter which the data type
>> is
>> >> >> string,
>> >> >> >>>> and
>> >> >> >>>> the field length in database is 19 char. But,it throws
>> exception
>> >> >> >>>> because
>> >> >> >>>> the
>> >> >> >>>> returned object is null. and then i try to change the WHERE
>> >> clause
>> >> >> >>>> condition,to based on other field which the data type is
>> >> number,and
>> >> >> it
>> >> >> >>>> works...
>> >> >> >>>> i want to know what is the problem,is the string value too
>> long
>> >> or
>> >> >> >>>> what?
>> >> >> >>>>
>> >> >> >>>> below is my code example :
>> >> >> >>>>
>> >> >> >>>> <select id="selectAccountById" parameterClass="Account"
>> >> >> >>>> resultClass="Account">
>> >> >> >>>>    select
>> >> >> >>>>      PX_IR025_PAN as pan,
>> >> >> >>>>      F9_IR025_CRN as CRN,
>> >> >> >>>>      FX_IR025_EMB_NAME as name,
>> >> >> >>>>      FX_IR025_CRD_PGM as crdPgm,
>> >> >> >>>>      FX_IR025_UPD_UID as updId
>> >> >> >>>>    from IR025
>> >> >> >>>>    where PX_IR025_PAN = #pan#
>> >> >> >>>> </select>
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>> in java:
>> >> >> >>>>
>> >> >> >>>> Account acc = new Account();
>> >> >> >>>>
>> >> >> >>>> acc.setpan("1234567890123456");
>> >> >> >>>>
>> >> >> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById",
>> >> acc);
>> >> >> >>>> //(Note : return null)
>> >> >> >>>> System.out.println("  " + acc.getname());
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>> Thanks before for your help....:-)
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>> --
>> >> >> >>>> View this message in context:
>> >> >> >>>>
>> >> >>
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>> >> >> >>>> Sent from the iBATIS - User - Java mailing list archive at
>> >> >> Nabble.com.
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> >>>> To unsubscribe, e-mail:
>> user-java-unsubscribe@ibatis.apache.org
>> >> >> >>>> For additional commands, e-mail:
>> user-java-help@ibatis.apache.org
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
>> >> >> >> Sent from the iBATIS - User - Java mailing list archive at
>> >> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> >> For additional commands, e-mail:
>> user-java-help@ibatis.apache.org
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> >> For additional commands, e-mail:
>> user-java-help@ibatis.apache.org
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> > --
>> >> >> > View this message in context:
>> >> >> >
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
>> >> >> > Sent from the iBATIS - User - Java mailing list archive at
>> >> Nabble.com.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >> >
>> >> >> >
>> >> >> >
>> >> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
>> >> >> Sent from the iBATIS - User - Java mailing list archive at
>> Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24419592.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24619051.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: AW: String parameter problem

Posted by Andrey Rogov <an...@gmail.com>.
mail me DDL table properties and IR025data .

2009/7/10 Cax <ca...@gmail.com>

>
> I use Oracle database.
>
>
> Sergey Livanov-2 wrote:
> >
> > What database do you use ?
> >
> > 2009/7/9 Cax <ca...@gmail.com>
> >
> >>
> >> i try to change the sql not to get the parameter, like this :
> >>
> >> select
> >>      PX_IR025_PAN as pan,
> >>      F9_IR025_CRN as CRN,
> >>      FX_IR025_EMB_NAME as name,
> >>      FX_IR025_CRD_PGM as crdPgm,
> >>      FX_IR025_UPD_UID as updId
> >>    from IR025
> >>     where PX_IR025_PAN = '1234567890123456'
> >>
> >> and it works....
> >>
> >>
> >> Andrey Rogov-2 wrote:
> >> >
> >> > hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
> >> > try to solve this problem with external sql runner, then copy sql
> >> > to xml files.
> >> >
> >> >
> >> > 2009/7/9 Cax <ca...@gmail.com>
> >> >
> >> >>
> >> >> Hi Benjamin,i'd tried this way before also...but it still hit the
> same
> >> >> problem... :(
> >> >>
> >> >>
> >> >>
> >> >> Benjamin-Klatt wrote:
> >> >> >
> >> >> > No there should not be any limitation that you will have to worry
> >> >> about.
> >> >> > What data type do you use in the database for the PX_IR025_PAN
> >> field?
> >> >> >
> >> >> > Can you try to explicitly define your sql data type in the query?
> >> >> > Like: where PX_IR025_PAN = #pan:VARCHAR#
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > -----Ursprüngliche Nachricht-----
> >> >> > Von: Cax [mailto:cahyadihermanto@gmail.com]
> >> >> > Gesendet: Mittwoch, 8. Juli 2009 19:08
> >> >> > An: user-java@ibatis.apache.org
> >> >> > Betreff: Re: AW: String parameter problem
> >> >> >
> >> >> >
> >> >> > yes,of course.there is a record which match the query. When i try
> to
> >> >> > change
> >> >> > the data type to Long,it works.but if String,return null value. And
> >> >> > then,when i change the WHERE clause condition,to based on other
> >> field
> >> >> > which
> >> >> > the data type is String also like this :
> >> >> >
> >> >> > select
> >> >> >       PX_IR025_PAN as pan,
> >> >> >       F9_IR025_CRN as CRN,
> >> >> >       FX_IR025_EMB_NAME as name,
> >> >> >       FX_IR025_CRD_PGM as crdPgm,
> >> >> >       FX_IR025_UPD_UID as updId
> >> >> >     from IR025
> >> >> >     where FX_IR025_UPD_UID = #updId#
> >> >> >
> >> >> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char
> >> >> > only...is
> >> >> > there any length limitation for String data type?
> >> >> >
> >> >> >
> >> >> >
> >> >> > Benjamin-Klatt wrote:
> >> >> >>
> >> >> >> Hi cax,
> >> >> >>
> >> >> >> have you tried to execute the query directly on the database to
> >> ensure
> >> >> >> there
> >> >> >> is a result for your query?
> >> >> >>
> >> >> >> br
> >> >> >> Benjamin
> >> >> >>
> >> >> >>
> >> >> >> -----Ursprüngliche Nachricht-----
> >> >> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
> >> >> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
> >> >> >> An: user-java@ibatis.apache.org
> >> >> >> Betreff: Re: String parameter problem
> >> >> >>
> >> >> >>
> >> >> >> Hi,i turn on Log4j,but i can't see what is the problem in the log
> >> >> >> file..here
> >> >> >> is the result in the log file :
> >> >> >>
> >> >> >> 2009-07-08 21:59:12,422 DEBUG main
> >> >> >> com.ibatis.common.jdbc.SimpleDataSource
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> Created
> >> >> >> connection 35293.
> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> >> {conn-100000}
> >> >> >> Connection
> >> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> >> {conn-100000}
> >> >> >> Preparing Statement:      select       PX_IR025_PAN as pan,
> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
> >> >> >> FX_IR025_CRD_PGM
> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
> >> where
> >> >> >> PX_IR025_PAN = ?
> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> >> {pstm-100001}
> >> >> >> Executing Statement:      select       PX_IR025_PAN as pan,
> >> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
> >> >> >> FX_IR025_CRD_PGM
> >> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025
> >> where
> >> >> >> PX_IR025_PAN = ?
> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> >> {pstm-100001}
> >> >> >> Parameters: [1234567890123456]
> >> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> >> {pstm-100001}
> >> >> >> Types: [java.lang.String]
> >> >> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
> >> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> >> {rset-100002}
> >> >> >> ResultSet
> >> >> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
> >> >> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
> >> >> >>
> >> >> >>
> >> >> >> Andrey Rogov-2 wrote:
> >> >> >>>
> >> >> >>> hi ,
> >> >> >>> turn on Log4j and look at the sql statement, prepare, parameter
> >> and
> >> >> >>> query
> >> >> >>> result .
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> 2009/7/7 Cax <ca...@gmail.com>
> >> >> >>>
> >> >> >>>>
> >> >> >>>> hello, I got a problem in iBatis, i hope somebody could help
> >> me...
> >> >> >>>> i hit problem when i pass in a parameter which the data type is
> >> >> string,
> >> >> >>>> and
> >> >> >>>> the field length in database is 19 char. But,it throws exception
> >> >> >>>> because
> >> >> >>>> the
> >> >> >>>> returned object is null. and then i try to change the WHERE
> >> clause
> >> >> >>>> condition,to based on other field which the data type is
> >> number,and
> >> >> it
> >> >> >>>> works...
> >> >> >>>> i want to know what is the problem,is the string value too long
> >> or
> >> >> >>>> what?
> >> >> >>>>
> >> >> >>>> below is my code example :
> >> >> >>>>
> >> >> >>>> <select id="selectAccountById" parameterClass="Account"
> >> >> >>>> resultClass="Account">
> >> >> >>>>    select
> >> >> >>>>      PX_IR025_PAN as pan,
> >> >> >>>>      F9_IR025_CRN as CRN,
> >> >> >>>>      FX_IR025_EMB_NAME as name,
> >> >> >>>>      FX_IR025_CRD_PGM as crdPgm,
> >> >> >>>>      FX_IR025_UPD_UID as updId
> >> >> >>>>    from IR025
> >> >> >>>>    where PX_IR025_PAN = #pan#
> >> >> >>>> </select>
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> in java:
> >> >> >>>>
> >> >> >>>> Account acc = new Account();
> >> >> >>>>
> >> >> >>>> acc.setpan("1234567890123456");
> >> >> >>>>
> >> >> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById",
> >> acc);
> >> >> >>>> //(Note : return null)
> >> >> >>>> System.out.println("  " + acc.getname());
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> Thanks before for your help....:-)
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> --
> >> >> >>>> View this message in context:
> >> >> >>>>
> >> >>
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
> >> >> >>>> Sent from the iBATIS - User - Java mailing list archive at
> >> >> Nabble.com.
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>
> >> >> ---------------------------------------------------------------------
> >> >> >>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> >>>> For additional commands, e-mail:
> user-java-help@ibatis.apache.org
> >> >> >>>>
> >> >> >>>>
> >> >> >>>
> >> >> >>>
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
> >> >> >> Sent from the iBATIS - User - Java mailing list archive at
> >> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >
> >> >> > --
> >> >> > View this message in context:
> >> >> >
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
> >> >> > Sent from the iBATIS - User - Java mailing list archive at
> >> Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
> >> >> Sent from the iBATIS - User - Java mailing list archive at
> Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24419592.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: AW: AW: String parameter problem

Posted by Cax <ca...@gmail.com>.
I use Oracle database.


Sergey Livanov-2 wrote:
> 
> What database do you use ?
> 
> 2009/7/9 Cax <ca...@gmail.com>
> 
>>
>> i try to change the sql not to get the parameter, like this :
>>
>> select
>>      PX_IR025_PAN as pan,
>>      F9_IR025_CRN as CRN,
>>      FX_IR025_EMB_NAME as name,
>>      FX_IR025_CRD_PGM as crdPgm,
>>      FX_IR025_UPD_UID as updId
>>    from IR025
>>     where PX_IR025_PAN = '1234567890123456'
>>
>> and it works....
>>
>>
>> Andrey Rogov-2 wrote:
>> >
>> > hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
>> > try to solve this problem with external sql runner, then copy sql
>> > to xml files.
>> >
>> >
>> > 2009/7/9 Cax <ca...@gmail.com>
>> >
>> >>
>> >> Hi Benjamin,i'd tried this way before also...but it still hit the same
>> >> problem... :(
>> >>
>> >>
>> >>
>> >> Benjamin-Klatt wrote:
>> >> >
>> >> > No there should not be any limitation that you will have to worry
>> >> about.
>> >> > What data type do you use in the database for the PX_IR025_PAN
>> field?
>> >> >
>> >> > Can you try to explicitly define your sql data type in the query?
>> >> > Like: where PX_IR025_PAN = #pan:VARCHAR#
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > -----Ursprüngliche Nachricht-----
>> >> > Von: Cax [mailto:cahyadihermanto@gmail.com]
>> >> > Gesendet: Mittwoch, 8. Juli 2009 19:08
>> >> > An: user-java@ibatis.apache.org
>> >> > Betreff: Re: AW: String parameter problem
>> >> >
>> >> >
>> >> > yes,of course.there is a record which match the query. When i try to
>> >> > change
>> >> > the data type to Long,it works.but if String,return null value. And
>> >> > then,when i change the WHERE clause condition,to based on other
>> field
>> >> > which
>> >> > the data type is String also like this :
>> >> >
>> >> > select
>> >> >       PX_IR025_PAN as pan,
>> >> >       F9_IR025_CRN as CRN,
>> >> >       FX_IR025_EMB_NAME as name,
>> >> >       FX_IR025_CRD_PGM as crdPgm,
>> >> >       FX_IR025_UPD_UID as updId
>> >> >     from IR025
>> >> >     where FX_IR025_UPD_UID = #updId#
>> >> >
>> >> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char
>> >> > only...is
>> >> > there any length limitation for String data type?
>> >> >
>> >> >
>> >> >
>> >> > Benjamin-Klatt wrote:
>> >> >>
>> >> >> Hi cax,
>> >> >>
>> >> >> have you tried to execute the query directly on the database to
>> ensure
>> >> >> there
>> >> >> is a result for your query?
>> >> >>
>> >> >> br
>> >> >> Benjamin
>> >> >>
>> >> >>
>> >> >> -----Ursprüngliche Nachricht-----
>> >> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
>> >> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
>> >> >> An: user-java@ibatis.apache.org
>> >> >> Betreff: Re: String parameter problem
>> >> >>
>> >> >>
>> >> >> Hi,i turn on Log4j,but i can't see what is the problem in the log
>> >> >> file..here
>> >> >> is the result in the log file :
>> >> >>
>> >> >> 2009-07-08 21:59:12,422 DEBUG main
>> >> >> com.ibatis.common.jdbc.SimpleDataSource
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> Created
>> >> >> connection 35293.
>> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> {conn-100000}
>> >> >> Connection
>> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> {conn-100000}
>> >> >> Preparing Statement:      select       PX_IR025_PAN as pan,
>> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>> >> >> FX_IR025_CRD_PGM
>> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025    
>> where
>> >> >> PX_IR025_PAN = ?
>> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> {pstm-100001}
>> >> >> Executing Statement:      select       PX_IR025_PAN as pan,
>> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>> >> >> FX_IR025_CRD_PGM
>> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025    
>> where
>> >> >> PX_IR025_PAN = ?
>> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> {pstm-100001}
>> >> >> Parameters: [1234567890123456]
>> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> {pstm-100001}
>> >> >> Types: [java.lang.String]
>> >> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
>> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> >> {rset-100002}
>> >> >> ResultSet
>> >> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
>> >> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
>> >> >>
>> >> >>
>> >> >> Andrey Rogov-2 wrote:
>> >> >>>
>> >> >>> hi ,
>> >> >>> turn on Log4j and look at the sql statement, prepare, parameter
>> and
>> >> >>> query
>> >> >>> result .
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> 2009/7/7 Cax <ca...@gmail.com>
>> >> >>>
>> >> >>>>
>> >> >>>> hello, I got a problem in iBatis, i hope somebody could help
>> me...
>> >> >>>> i hit problem when i pass in a parameter which the data type is
>> >> string,
>> >> >>>> and
>> >> >>>> the field length in database is 19 char. But,it throws exception
>> >> >>>> because
>> >> >>>> the
>> >> >>>> returned object is null. and then i try to change the WHERE
>> clause
>> >> >>>> condition,to based on other field which the data type is
>> number,and
>> >> it
>> >> >>>> works...
>> >> >>>> i want to know what is the problem,is the string value too long
>> or
>> >> >>>> what?
>> >> >>>>
>> >> >>>> below is my code example :
>> >> >>>>
>> >> >>>> <select id="selectAccountById" parameterClass="Account"
>> >> >>>> resultClass="Account">
>> >> >>>>    select
>> >> >>>>      PX_IR025_PAN as pan,
>> >> >>>>      F9_IR025_CRN as CRN,
>> >> >>>>      FX_IR025_EMB_NAME as name,
>> >> >>>>      FX_IR025_CRD_PGM as crdPgm,
>> >> >>>>      FX_IR025_UPD_UID as updId
>> >> >>>>    from IR025
>> >> >>>>    where PX_IR025_PAN = #pan#
>> >> >>>> </select>
>> >> >>>>
>> >> >>>>
>> >> >>>> in java:
>> >> >>>>
>> >> >>>> Account acc = new Account();
>> >> >>>>
>> >> >>>> acc.setpan("1234567890123456");
>> >> >>>>
>> >> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById",
>> acc);
>> >> >>>> //(Note : return null)
>> >> >>>> System.out.println("  " + acc.getname());
>> >> >>>>
>> >> >>>>
>> >> >>>> Thanks before for your help....:-)
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> --
>> >> >>>> View this message in context:
>> >> >>>>
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>> >> >>>> Sent from the iBATIS - User - Java mailing list archive at
>> >> Nabble.com.
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> ---------------------------------------------------------------------
>> >> >>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >>>>
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
>> >> >> Sent from the iBATIS - User - Java mailing list archive at
>> Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
>> >> > Sent from the iBATIS - User - Java mailing list archive at
>> Nabble.com.
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24419592.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: AW: String parameter problem

Posted by Sergey Livanov <se...@gmail.com>.
What database do you use ?

2009/7/9 Cax <ca...@gmail.com>

>
> i try to change the sql not to get the parameter, like this :
>
> select
>      PX_IR025_PAN as pan,
>      F9_IR025_CRN as CRN,
>      FX_IR025_EMB_NAME as name,
>      FX_IR025_CRD_PGM as crdPgm,
>      FX_IR025_UPD_UID as updId
>    from IR025
>     where PX_IR025_PAN = '1234567890123456'
>
> and it works....
>
>
> Andrey Rogov-2 wrote:
> >
> > hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
> > try to solve this problem with external sql runner, then copy sql
> > to xml files.
> >
> >
> > 2009/7/9 Cax <ca...@gmail.com>
> >
> >>
> >> Hi Benjamin,i'd tried this way before also...but it still hit the same
> >> problem... :(
> >>
> >>
> >>
> >> Benjamin-Klatt wrote:
> >> >
> >> > No there should not be any limitation that you will have to worry
> >> about.
> >> > What data type do you use in the database for the PX_IR025_PAN field?
> >> >
> >> > Can you try to explicitly define your sql data type in the query?
> >> > Like: where PX_IR025_PAN = #pan:VARCHAR#
> >> >
> >> >
> >> >
> >> >
> >> > -----Ursprüngliche Nachricht-----
> >> > Von: Cax [mailto:cahyadihermanto@gmail.com]
> >> > Gesendet: Mittwoch, 8. Juli 2009 19:08
> >> > An: user-java@ibatis.apache.org
> >> > Betreff: Re: AW: String parameter problem
> >> >
> >> >
> >> > yes,of course.there is a record which match the query. When i try to
> >> > change
> >> > the data type to Long,it works.but if String,return null value. And
> >> > then,when i change the WHERE clause condition,to based on other field
> >> > which
> >> > the data type is String also like this :
> >> >
> >> > select
> >> >       PX_IR025_PAN as pan,
> >> >       F9_IR025_CRN as CRN,
> >> >       FX_IR025_EMB_NAME as name,
> >> >       FX_IR025_CRD_PGM as crdPgm,
> >> >       FX_IR025_UPD_UID as updId
> >> >     from IR025
> >> >     where FX_IR025_UPD_UID = #updId#
> >> >
> >> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char
> >> > only...is
> >> > there any length limitation for String data type?
> >> >
> >> >
> >> >
> >> > Benjamin-Klatt wrote:
> >> >>
> >> >> Hi cax,
> >> >>
> >> >> have you tried to execute the query directly on the database to
> ensure
> >> >> there
> >> >> is a result for your query?
> >> >>
> >> >> br
> >> >> Benjamin
> >> >>
> >> >>
> >> >> -----Ursprüngliche Nachricht-----
> >> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
> >> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
> >> >> An: user-java@ibatis.apache.org
> >> >> Betreff: Re: String parameter problem
> >> >>
> >> >>
> >> >> Hi,i turn on Log4j,but i can't see what is the problem in the log
> >> >> file..here
> >> >> is the result in the log file :
> >> >>
> >> >> 2009-07-08 21:59:12,422 DEBUG main
> >> >> com.ibatis.common.jdbc.SimpleDataSource
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
> >> >> connection 35293.
> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> {conn-100000}
> >> >> Connection
> >> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> {conn-100000}
> >> >> Preparing Statement:      select       PX_IR025_PAN as pan,
> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
> >> >> FX_IR025_CRD_PGM
> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> >> >> PX_IR025_PAN = ?
> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> {pstm-100001}
> >> >> Executing Statement:      select       PX_IR025_PAN as pan,
> >> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
> >> >> FX_IR025_CRD_PGM
> >> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> >> >> PX_IR025_PAN = ?
> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> {pstm-100001}
> >> >> Parameters: [1234567890123456]
> >> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> {pstm-100001}
> >> >> Types: [java.lang.String]
> >> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
> >> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> >> {rset-100002}
> >> >> ResultSet
> >> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
> >> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
> >> >>
> >> >>
> >> >> Andrey Rogov-2 wrote:
> >> >>>
> >> >>> hi ,
> >> >>> turn on Log4j and look at the sql statement, prepare, parameter and
> >> >>> query
> >> >>> result .
> >> >>>
> >> >>>
> >> >>>
> >> >>> 2009/7/7 Cax <ca...@gmail.com>
> >> >>>
> >> >>>>
> >> >>>> hello, I got a problem in iBatis, i hope somebody could help me...
> >> >>>> i hit problem when i pass in a parameter which the data type is
> >> string,
> >> >>>> and
> >> >>>> the field length in database is 19 char. But,it throws exception
> >> >>>> because
> >> >>>> the
> >> >>>> returned object is null. and then i try to change the WHERE clause
> >> >>>> condition,to based on other field which the data type is number,and
> >> it
> >> >>>> works...
> >> >>>> i want to know what is the problem,is the string value too long or
> >> >>>> what?
> >> >>>>
> >> >>>> below is my code example :
> >> >>>>
> >> >>>> <select id="selectAccountById" parameterClass="Account"
> >> >>>> resultClass="Account">
> >> >>>>    select
> >> >>>>      PX_IR025_PAN as pan,
> >> >>>>      F9_IR025_CRN as CRN,
> >> >>>>      FX_IR025_EMB_NAME as name,
> >> >>>>      FX_IR025_CRD_PGM as crdPgm,
> >> >>>>      FX_IR025_UPD_UID as updId
> >> >>>>    from IR025
> >> >>>>    where PX_IR025_PAN = #pan#
> >> >>>> </select>
> >> >>>>
> >> >>>>
> >> >>>> in java:
> >> >>>>
> >> >>>> Account acc = new Account();
> >> >>>>
> >> >>>> acc.setpan("1234567890123456");
> >> >>>>
> >> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
> >> >>>> //(Note : return null)
> >> >>>> System.out.println("  " + acc.getname());
> >> >>>>
> >> >>>>
> >> >>>> Thanks before for your help....:-)
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> --
> >> >>>> View this message in context:
> >> >>>>
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
> >> >>>> Sent from the iBATIS - User - Java mailing list archive at
> >> Nabble.com.
> >> >>>>
> >> >>>>
> >> >>>>
> >> ---------------------------------------------------------------------
> >> >>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >>>>
> >> >>>>
> >> >>>
> >> >>>
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
> >> >> Sent from the iBATIS - User - Java mailing list archive at
> Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >>
> >> >>
> >> >>
> >> >
> >> > --
> >> > View this message in context:
> >> >
> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
> >> > Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: AW: AW: String parameter problem

Posted by Cax <ca...@gmail.com>.
i try to change the sql not to get the parameter, like this :

select
      PX_IR025_PAN as pan,
      F9_IR025_CRN as CRN,
      FX_IR025_EMB_NAME as name,
      FX_IR025_CRD_PGM as crdPgm,
      FX_IR025_UPD_UID as updId 
    from IR025
    where PX_IR025_PAN = '1234567890123456'

and it works....


Andrey Rogov-2 wrote:
> 
> hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
> try to solve this problem with external sql runner, then copy sql
> to xml files.
> 
> 
> 2009/7/9 Cax <ca...@gmail.com>
> 
>>
>> Hi Benjamin,i'd tried this way before also...but it still hit the same
>> problem... :(
>>
>>
>>
>> Benjamin-Klatt wrote:
>> >
>> > No there should not be any limitation that you will have to worry
>> about.
>> > What data type do you use in the database for the PX_IR025_PAN field?
>> >
>> > Can you try to explicitly define your sql data type in the query?
>> > Like: where PX_IR025_PAN = #pan:VARCHAR#
>> >
>> >
>> >
>> >
>> > -----Ursprüngliche Nachricht-----
>> > Von: Cax [mailto:cahyadihermanto@gmail.com]
>> > Gesendet: Mittwoch, 8. Juli 2009 19:08
>> > An: user-java@ibatis.apache.org
>> > Betreff: Re: AW: String parameter problem
>> >
>> >
>> > yes,of course.there is a record which match the query. When i try to
>> > change
>> > the data type to Long,it works.but if String,return null value. And
>> > then,when i change the WHERE clause condition,to based on other field
>> > which
>> > the data type is String also like this :
>> >
>> > select
>> >       PX_IR025_PAN as pan,
>> >       F9_IR025_CRN as CRN,
>> >       FX_IR025_EMB_NAME as name,
>> >       FX_IR025_CRD_PGM as crdPgm,
>> >       FX_IR025_UPD_UID as updId
>> >     from IR025
>> >     where FX_IR025_UPD_UID = #updId#
>> >
>> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char
>> > only...is
>> > there any length limitation for String data type?
>> >
>> >
>> >
>> > Benjamin-Klatt wrote:
>> >>
>> >> Hi cax,
>> >>
>> >> have you tried to execute the query directly on the database to ensure
>> >> there
>> >> is a result for your query?
>> >>
>> >> br
>> >> Benjamin
>> >>
>> >>
>> >> -----Ursprüngliche Nachricht-----
>> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
>> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
>> >> An: user-java@ibatis.apache.org
>> >> Betreff: Re: String parameter problem
>> >>
>> >>
>> >> Hi,i turn on Log4j,but i can't see what is the problem in the log
>> >> file..here
>> >> is the result in the log file :
>> >>
>> >> 2009-07-08 21:59:12,422 DEBUG main
>> >> com.ibatis.common.jdbc.SimpleDataSource
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
>> >> connection 35293.
>> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> {conn-100000}
>> >> Connection
>> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> {conn-100000}
>> >> Preparing Statement:      select       PX_IR025_PAN as pan,
>> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>> >> FX_IR025_CRD_PGM
>> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
>> >> PX_IR025_PAN = ?
>> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> {pstm-100001}
>> >> Executing Statement:      select       PX_IR025_PAN as pan,
>> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
>> >> FX_IR025_CRD_PGM
>> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
>> >> PX_IR025_PAN = ?
>> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> {pstm-100001}
>> >> Parameters: [1234567890123456]
>> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> {pstm-100001}
>> >> Types: [java.lang.String]
>> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
>> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> >> {rset-100002}
>> >> ResultSet
>> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
>> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
>> >>
>> >>
>> >> Andrey Rogov-2 wrote:
>> >>>
>> >>> hi ,
>> >>> turn on Log4j and look at the sql statement, prepare, parameter and
>> >>> query
>> >>> result .
>> >>>
>> >>>
>> >>>
>> >>> 2009/7/7 Cax <ca...@gmail.com>
>> >>>
>> >>>>
>> >>>> hello, I got a problem in iBatis, i hope somebody could help me...
>> >>>> i hit problem when i pass in a parameter which the data type is
>> string,
>> >>>> and
>> >>>> the field length in database is 19 char. But,it throws exception
>> >>>> because
>> >>>> the
>> >>>> returned object is null. and then i try to change the WHERE clause
>> >>>> condition,to based on other field which the data type is number,and
>> it
>> >>>> works...
>> >>>> i want to know what is the problem,is the string value too long or
>> >>>> what?
>> >>>>
>> >>>> below is my code example :
>> >>>>
>> >>>> <select id="selectAccountById" parameterClass="Account"
>> >>>> resultClass="Account">
>> >>>>    select
>> >>>>      PX_IR025_PAN as pan,
>> >>>>      F9_IR025_CRN as CRN,
>> >>>>      FX_IR025_EMB_NAME as name,
>> >>>>      FX_IR025_CRD_PGM as crdPgm,
>> >>>>      FX_IR025_UPD_UID as updId
>> >>>>    from IR025
>> >>>>    where PX_IR025_PAN = #pan#
>> >>>> </select>
>> >>>>
>> >>>>
>> >>>> in java:
>> >>>>
>> >>>> Account acc = new Account();
>> >>>>
>> >>>> acc.setpan("1234567890123456");
>> >>>>
>> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
>> >>>> //(Note : return null)
>> >>>> System.out.println("  " + acc.getname());
>> >>>>
>> >>>>
>> >>>> Thanks before for your help....:-)
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> View this message in context:
>> >>>>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>> >>>> Sent from the iBATIS - User - Java mailing list archive at
>> Nabble.com.
>> >>>>
>> >>>>
>> >>>>
>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>
>> >>
>> >>
>> >
>> > --
>> > View this message in context:
>> > http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
>> > Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24414345.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: AW: String parameter problem

Posted by Andrey Rogov <an...@gmail.com>.
hi Cax, iBatis doesn't resolve sql problems, it is sql mapper.
try to solve this problem with external sql runner, then copy sql
to xml files.


2009/7/9 Cax <ca...@gmail.com>

>
> Hi Benjamin,i'd tried this way before also...but it still hit the same
> problem... :(
>
>
>
> Benjamin-Klatt wrote:
> >
> > No there should not be any limitation that you will have to worry about.
> > What data type do you use in the database for the PX_IR025_PAN field?
> >
> > Can you try to explicitly define your sql data type in the query?
> > Like: where PX_IR025_PAN = #pan:VARCHAR#
> >
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Cax [mailto:cahyadihermanto@gmail.com]
> > Gesendet: Mittwoch, 8. Juli 2009 19:08
> > An: user-java@ibatis.apache.org
> > Betreff: Re: AW: String parameter problem
> >
> >
> > yes,of course.there is a record which match the query. When i try to
> > change
> > the data type to Long,it works.but if String,return null value. And
> > then,when i change the WHERE clause condition,to based on other field
> > which
> > the data type is String also like this :
> >
> > select
> >       PX_IR025_PAN as pan,
> >       F9_IR025_CRN as CRN,
> >       FX_IR025_EMB_NAME as name,
> >       FX_IR025_CRD_PGM as crdPgm,
> >       FX_IR025_UPD_UID as updId
> >     from IR025
> >     where FX_IR025_UPD_UID = #updId#
> >
> > and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char
> > only...is
> > there any length limitation for String data type?
> >
> >
> >
> > Benjamin-Klatt wrote:
> >>
> >> Hi cax,
> >>
> >> have you tried to execute the query directly on the database to ensure
> >> there
> >> is a result for your query?
> >>
> >> br
> >> Benjamin
> >>
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: Cax [mailto:cahyadihermanto@gmail.com]
> >> Gesendet: Mittwoch, 8. Juli 2009 17:31
> >> An: user-java@ibatis.apache.org
> >> Betreff: Re: String parameter problem
> >>
> >>
> >> Hi,i turn on Log4j,but i can't see what is the problem in the log
> >> file..here
> >> is the result in the log file :
> >>
> >> 2009-07-08 21:59:12,422 DEBUG main
> >> com.ibatis.common.jdbc.SimpleDataSource
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
> >> connection 35293.
> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> {conn-100000}
> >> Connection
> >> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> {conn-100000}
> >> Preparing Statement:      select       PX_IR025_PAN as pan,
> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
> >> FX_IR025_CRD_PGM
> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> >> PX_IR025_PAN = ?
> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> {pstm-100001}
> >> Executing Statement:      select       PX_IR025_PAN as pan,
> >> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,
> >> FX_IR025_CRD_PGM
> >> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> >> PX_IR025_PAN = ?
> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> {pstm-100001}
> >> Parameters: [1234567890123456]
> >> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> {pstm-100001}
> >> Types: [java.lang.String]
> >> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
> >> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> >> {rset-100002}
> >> ResultSet
> >> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
> >> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
> >>
> >>
> >> Andrey Rogov-2 wrote:
> >>>
> >>> hi ,
> >>> turn on Log4j and look at the sql statement, prepare, parameter and
> >>> query
> >>> result .
> >>>
> >>>
> >>>
> >>> 2009/7/7 Cax <ca...@gmail.com>
> >>>
> >>>>
> >>>> hello, I got a problem in iBatis, i hope somebody could help me...
> >>>> i hit problem when i pass in a parameter which the data type is
> string,
> >>>> and
> >>>> the field length in database is 19 char. But,it throws exception
> >>>> because
> >>>> the
> >>>> returned object is null. and then i try to change the WHERE clause
> >>>> condition,to based on other field which the data type is number,and it
> >>>> works...
> >>>> i want to know what is the problem,is the string value too long or
> >>>> what?
> >>>>
> >>>> below is my code example :
> >>>>
> >>>> <select id="selectAccountById" parameterClass="Account"
> >>>> resultClass="Account">
> >>>>    select
> >>>>      PX_IR025_PAN as pan,
> >>>>      F9_IR025_CRN as CRN,
> >>>>      FX_IR025_EMB_NAME as name,
> >>>>      FX_IR025_CRD_PGM as crdPgm,
> >>>>      FX_IR025_UPD_UID as updId
> >>>>    from IR025
> >>>>    where PX_IR025_PAN = #pan#
> >>>> </select>
> >>>>
> >>>>
> >>>> in java:
> >>>>
> >>>> Account acc = new Account();
> >>>>
> >>>> acc.setpan("1234567890123456");
> >>>>
> >>>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
> >>>> //(Note : return null)
> >>>> System.out.println("  " + acc.getname());
> >>>>
> >>>>
> >>>> Thanks before for your help....:-)
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> View this message in context:
> >>>>
> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
> >>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >>
> >>
> >
> > --
> > View this message in context:
> > http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
> > Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: AW: AW: String parameter problem

Posted by Cax <ca...@gmail.com>.
Hi Benjamin,i'd tried this way before also...but it still hit the same
problem... :(



Benjamin-Klatt wrote:
> 
> No there should not be any limitation that you will have to worry about.
> What data type do you use in the database for the PX_IR025_PAN field?
> 
> Can you try to explicitly define your sql data type in the query?
> Like: where PX_IR025_PAN = #pan:VARCHAR#
> 
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Cax [mailto:cahyadihermanto@gmail.com] 
> Gesendet: Mittwoch, 8. Juli 2009 19:08
> An: user-java@ibatis.apache.org
> Betreff: Re: AW: String parameter problem
> 
> 
> yes,of course.there is a record which match the query. When i try to
> change
> the data type to Long,it works.but if String,return null value. And
> then,when i change the WHERE clause condition,to based on other field
> which
> the data type is String also like this :
> 
> select
>       PX_IR025_PAN as pan,
>       F9_IR025_CRN as CRN,
>       FX_IR025_EMB_NAME as name,
>       FX_IR025_CRD_PGM as crdPgm,
>       FX_IR025_UPD_UID as updId
>     from IR025
>     where FX_IR025_UPD_UID = #updId#
> 
> and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char
> only...is
> there any length limitation for String data type?
> 
> 
> 
> Benjamin-Klatt wrote:
>> 
>> Hi cax,
>> 
>> have you tried to execute the query directly on the database to ensure
>> there
>> is a result for your query?
>> 
>> br
>> Benjamin
>> 
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: Cax [mailto:cahyadihermanto@gmail.com] 
>> Gesendet: Mittwoch, 8. Juli 2009 17:31
>> An: user-java@ibatis.apache.org
>> Betreff: Re: String parameter problem
>> 
>> 
>> Hi,i turn on Log4j,but i can't see what is the problem in the log
>> file..here
>> is the result in the log file :
>> 
>> 2009-07-08 21:59:12,422 DEBUG main
>> com.ibatis.common.jdbc.SimpleDataSource
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
>> connection 35293.
>> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> {conn-100000}
>> Connection
>> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> {conn-100000}
>> Preparing Statement:      select       PX_IR025_PAN as pan,      
>> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,      
>> FX_IR025_CRD_PGM
>> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
>> PX_IR025_PAN = ?       
>> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> {pstm-100001}
>> Executing Statement:      select       PX_IR025_PAN as pan,      
>> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,      
>> FX_IR025_CRD_PGM
>> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
>> PX_IR025_PAN = ?       
>> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> {pstm-100001}
>> Parameters: [1234567890123456]
>> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> {pstm-100001}
>> Types: [java.lang.String]
>> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
>> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
>> {rset-100002}
>> ResultSet
>> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
>> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
>> 
>> 
>> Andrey Rogov-2 wrote:
>>> 
>>> hi ,
>>> turn on Log4j and look at the sql statement, prepare, parameter and
>>> query
>>> result .
>>> 
>>> 
>>> 
>>> 2009/7/7 Cax <ca...@gmail.com>
>>> 
>>>>
>>>> hello, I got a problem in iBatis, i hope somebody could help me...
>>>> i hit problem when i pass in a parameter which the data type is string,
>>>> and
>>>> the field length in database is 19 char. But,it throws exception
>>>> because
>>>> the
>>>> returned object is null. and then i try to change the WHERE clause
>>>> condition,to based on other field which the data type is number,and it
>>>> works...
>>>> i want to know what is the problem,is the string value too long or
>>>> what?
>>>>
>>>> below is my code example :
>>>>
>>>> <select id="selectAccountById" parameterClass="Account"
>>>> resultClass="Account">
>>>>    select
>>>>      PX_IR025_PAN as pan,
>>>>      F9_IR025_CRN as CRN,
>>>>      FX_IR025_EMB_NAME as name,
>>>>      FX_IR025_CRD_PGM as crdPgm,
>>>>      FX_IR025_UPD_UID as updId
>>>>    from IR025
>>>>    where PX_IR025_PAN = #pan#
>>>> </select>
>>>>
>>>>
>>>> in java:
>>>>
>>>> Account acc = new Account();
>>>>
>>>> acc.setpan("1234567890123456");
>>>>
>>>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
>>>> //(Note : return null)
>>>> System.out.println("  " + acc.getname());
>>>>
>>>>
>>>> Thanks before for your help....:-)
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>>
>>>>
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24410991.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


AW: AW: String parameter problem

Posted by Benjamin Klatt <be...@bar54.de>.
No there should not be any limitation that you will have to worry about.
What data type do you use in the database for the PX_IR025_PAN field?

Can you try to explicitly define your sql data type in the query?
Like: where PX_IR025_PAN = #pan:VARCHAR#




-----Ursprüngliche Nachricht-----
Von: Cax [mailto:cahyadihermanto@gmail.com] 
Gesendet: Mittwoch, 8. Juli 2009 19:08
An: user-java@ibatis.apache.org
Betreff: Re: AW: String parameter problem


yes,of course.there is a record which match the query. When i try to change
the data type to Long,it works.but if String,return null value. And
then,when i change the WHERE clause condition,to based on other field which
the data type is String also like this :

select
      PX_IR025_PAN as pan,
      F9_IR025_CRN as CRN,
      FX_IR025_EMB_NAME as name,
      FX_IR025_CRD_PGM as crdPgm,
      FX_IR025_UPD_UID as updId
    from IR025
    where FX_IR025_UPD_UID = #updId#

and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char only...is
there any length limitation for String data type?



Benjamin-Klatt wrote:
> 
> Hi cax,
> 
> have you tried to execute the query directly on the database to ensure
> there
> is a result for your query?
> 
> br
> Benjamin
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Cax [mailto:cahyadihermanto@gmail.com] 
> Gesendet: Mittwoch, 8. Juli 2009 17:31
> An: user-java@ibatis.apache.org
> Betreff: Re: String parameter problem
> 
> 
> Hi,i turn on Log4j,but i can't see what is the problem in the log
> file..here
> is the result in the log file :
> 
> 2009-07-08 21:59:12,422 DEBUG main com.ibatis.common.jdbc.SimpleDataSource
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
> connection 35293.
> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {conn-100000}
> Connection
> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {conn-100000}
> Preparing Statement:      select       PX_IR025_PAN as pan,      
> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,      
> FX_IR025_CRD_PGM
> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> PX_IR025_PAN = ?       
> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {pstm-100001}
> Executing Statement:      select       PX_IR025_PAN as pan,      
> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,      
> FX_IR025_CRD_PGM
> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> PX_IR025_PAN = ?       
> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {pstm-100001}
> Parameters: [1234567890123456]
> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {pstm-100001}
> Types: [java.lang.String]
> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {rset-100002}
> ResultSet
> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
> 
> 
> Andrey Rogov-2 wrote:
>> 
>> hi ,
>> turn on Log4j and look at the sql statement, prepare, parameter and query
>> result .
>> 
>> 
>> 
>> 2009/7/7 Cax <ca...@gmail.com>
>> 
>>>
>>> hello, I got a problem in iBatis, i hope somebody could help me...
>>> i hit problem when i pass in a parameter which the data type is string,
>>> and
>>> the field length in database is 19 char. But,it throws exception because
>>> the
>>> returned object is null. and then i try to change the WHERE clause
>>> condition,to based on other field which the data type is number,and it
>>> works...
>>> i want to know what is the problem,is the string value too long or what?
>>>
>>> below is my code example :
>>>
>>> <select id="selectAccountById" parameterClass="Account"
>>> resultClass="Account">
>>>    select
>>>      PX_IR025_PAN as pan,
>>>      F9_IR025_CRN as CRN,
>>>      FX_IR025_EMB_NAME as name,
>>>      FX_IR025_CRD_PGM as crdPgm,
>>>      FX_IR025_UPD_UID as updId
>>>    from IR025
>>>    where PX_IR025_PAN = #pan#
>>> </select>
>>>
>>>
>>> in java:
>>>
>>> Account acc = new Account();
>>>
>>> acc.setpan("1234567890123456");
>>>
>>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
>>> //(Note : return null)
>>> System.out.println("  " + acc.getname());
>>>
>>>
>>> Thanks before for your help....:-)
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: AW: String parameter problem

Posted by Cax <ca...@gmail.com>.
yes,of course.there is a record which match the query. When i try to change
the data type to Long,it works.but if String,return null value. And
then,when i change the WHERE clause condition,to based on other field which
the data type is String also like this :

select
      PX_IR025_PAN as pan,
      F9_IR025_CRN as CRN,
      FX_IR025_EMB_NAME as name,
      FX_IR025_CRD_PGM as crdPgm,
      FX_IR025_UPD_UID as updId
    from IR025
    where FX_IR025_UPD_UID = #updId#

and it works...FYI,the field length for FX_IR025_UPD_UID is 8 char only...is
there any length limitation for String data type?



Benjamin-Klatt wrote:
> 
> Hi cax,
> 
> have you tried to execute the query directly on the database to ensure
> there
> is a result for your query?
> 
> br
> Benjamin
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Cax [mailto:cahyadihermanto@gmail.com] 
> Gesendet: Mittwoch, 8. Juli 2009 17:31
> An: user-java@ibatis.apache.org
> Betreff: Re: String parameter problem
> 
> 
> Hi,i turn on Log4j,but i can't see what is the problem in the log
> file..here
> is the result in the log file :
> 
> 2009-07-08 21:59:12,422 DEBUG main com.ibatis.common.jdbc.SimpleDataSource
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
> connection 35293.
> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {conn-100000}
> Connection
> 2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {conn-100000}
> Preparing Statement:      select       PX_IR025_PAN as pan,      
> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,      
> FX_IR025_CRD_PGM
> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> PX_IR025_PAN = ?       
> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {pstm-100001}
> Executing Statement:      select       PX_IR025_PAN as pan,      
> F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,      
> FX_IR025_CRD_PGM
> as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
> PX_IR025_PAN = ?       
> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {pstm-100001}
> Parameters: [1234567890123456]
> 2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {pstm-100001}
> Types: [java.lang.String]
> 2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
> com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl -
> {rset-100002}
> ResultSet
> 2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
> ibatis.com.mydomain.data.Main - java.lang.NullPointerException
> 
> 
> Andrey Rogov-2 wrote:
>> 
>> hi ,
>> turn on Log4j and look at the sql statement, prepare, parameter and query
>> result .
>> 
>> 
>> 
>> 2009/7/7 Cax <ca...@gmail.com>
>> 
>>>
>>> hello, I got a problem in iBatis, i hope somebody could help me...
>>> i hit problem when i pass in a parameter which the data type is string,
>>> and
>>> the field length in database is 19 char. But,it throws exception because
>>> the
>>> returned object is null. and then i try to change the WHERE clause
>>> condition,to based on other field which the data type is number,and it
>>> works...
>>> i want to know what is the problem,is the string value too long or what?
>>>
>>> below is my code example :
>>>
>>> <select id="selectAccountById" parameterClass="Account"
>>> resultClass="Account">
>>>    select
>>>      PX_IR025_PAN as pan,
>>>      F9_IR025_CRN as CRN,
>>>      FX_IR025_EMB_NAME as name,
>>>      FX_IR025_CRD_PGM as crdPgm,
>>>      FX_IR025_UPD_UID as updId
>>>    from IR025
>>>    where PX_IR025_PAN = #pan#
>>> </select>
>>>
>>>
>>> in java:
>>>
>>> Account acc = new Account();
>>>
>>> acc.setpan("1234567890123456");
>>>
>>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
>>> //(Note : return null)
>>> System.out.println("  " + acc.getname());
>>>
>>>
>>> Thanks before for your help....:-)
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24395565.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


AW: String parameter problem

Posted by Benjamin Klatt <be...@bar54.de>.
Hi cax,

have you tried to execute the query directly on the database to ensure there
is a result for your query?

br
Benjamin


-----Ursprüngliche Nachricht-----
Von: Cax [mailto:cahyadihermanto@gmail.com] 
Gesendet: Mittwoch, 8. Juli 2009 17:31
An: user-java@ibatis.apache.org
Betreff: Re: String parameter problem


Hi,i turn on Log4j,but i can't see what is the problem in the log file..here
is the result in the log file :

2009-07-08 21:59:12,422 DEBUG main com.ibatis.common.jdbc.SimpleDataSource
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
connection 35293.
2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {conn-100000}
Connection
2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {conn-100000}
Preparing Statement:      select       PX_IR025_PAN as pan,      
F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,       FX_IR025_CRD_PGM
as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
PX_IR025_PAN = ?       
2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {pstm-100001}
Executing Statement:      select       PX_IR025_PAN as pan,      
F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,       FX_IR025_CRD_PGM
as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
PX_IR025_PAN = ?       
2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {pstm-100001}
Parameters: [1234567890123456]
2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {pstm-100001}
Types: [java.lang.String]
2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {rset-100002}
ResultSet
2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
ibatis.com.mydomain.data.Main - java.lang.NullPointerException


Andrey Rogov-2 wrote:
> 
> hi ,
> turn on Log4j and look at the sql statement, prepare, parameter and query
> result .
> 
> 
> 
> 2009/7/7 Cax <ca...@gmail.com>
> 
>>
>> hello, I got a problem in iBatis, i hope somebody could help me...
>> i hit problem when i pass in a parameter which the data type is string,
>> and
>> the field length in database is 19 char. But,it throws exception because
>> the
>> returned object is null. and then i try to change the WHERE clause
>> condition,to based on other field which the data type is number,and it
>> works...
>> i want to know what is the problem,is the string value too long or what?
>>
>> below is my code example :
>>
>> <select id="selectAccountById" parameterClass="Account"
>> resultClass="Account">
>>    select
>>      PX_IR025_PAN as pan,
>>      F9_IR025_CRN as CRN,
>>      FX_IR025_EMB_NAME as name,
>>      FX_IR025_CRD_PGM as crdPgm,
>>      FX_IR025_UPD_UID as updId
>>    from IR025
>>    where PX_IR025_PAN = #pan#
>> </select>
>>
>>
>> in java:
>>
>> Account acc = new Account();
>>
>> acc.setpan("1234567890123456");
>>
>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
>> //(Note : return null)
>> System.out.println("  " + acc.getname());
>>
>>
>> Thanks before for your help....:-)
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context:
http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: String parameter problem

Posted by Cax <ca...@gmail.com>.
Hi,i turn on Log4j,but i can't see what is the problem in the log file..here
is the result in the log file :

2009-07-08 21:59:12,422 DEBUG main com.ibatis.common.jdbc.SimpleDataSource
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - Created
connection 35293.
2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {conn-100000}
Connection
2009-07-08 21:59:12,438 DEBUG main java.sql.Connection
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {conn-100000}
Preparing Statement:      select       PX_IR025_PAN as pan,      
F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,       FX_IR025_CRD_PGM
as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
PX_IR025_PAN = ?       
2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {pstm-100001}
Executing Statement:      select       PX_IR025_PAN as pan,      
F9_IR025_CRN as CRN,       FX_IR025_EMB_NAME as name,       FX_IR025_CRD_PGM
as crdPgm,       FX_IR025_UPD_UID as updId      from IR025     where
PX_IR025_PAN = ?       
2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {pstm-100001}
Parameters: [1234567890123456]
2009-07-08 21:59:12,703 DEBUG main java.sql.PreparedStatement
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {pstm-100001}
Types: [java.lang.String]
2009-07-08 21:59:12,734 DEBUG main java.sql.ResultSet
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl - {rset-100002}
ResultSet
2009-07-08 22:08:43,805 ERROR main ibatis.com.mydomain.data.Main
ibatis.com.mydomain.data.Main - java.lang.NullPointerException


Andrey Rogov-2 wrote:
> 
> hi ,
> turn on Log4j and look at the sql statement, prepare, parameter and query
> result .
> 
> 
> 
> 2009/7/7 Cax <ca...@gmail.com>
> 
>>
>> hello, I got a problem in iBatis, i hope somebody could help me...
>> i hit problem when i pass in a parameter which the data type is string,
>> and
>> the field length in database is 19 char. But,it throws exception because
>> the
>> returned object is null. and then i try to change the WHERE clause
>> condition,to based on other field which the data type is number,and it
>> works...
>> i want to know what is the problem,is the string value too long or what?
>>
>> below is my code example :
>>
>> <select id="selectAccountById" parameterClass="Account"
>> resultClass="Account">
>>    select
>>      PX_IR025_PAN as pan,
>>      F9_IR025_CRN as CRN,
>>      FX_IR025_EMB_NAME as name,
>>      FX_IR025_CRD_PGM as crdPgm,
>>      FX_IR025_UPD_UID as updId
>>    from IR025
>>    where PX_IR025_PAN = #pan#
>> </select>
>>
>>
>> in java:
>>
>> Account acc = new Account();
>>
>> acc.setpan("1234567890123456");
>>
>> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
>> //(Note : return null)
>> System.out.println("  " + acc.getname());
>>
>>
>> Thanks before for your help....:-)
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/String-parameter-problem-tp24370405p24393125.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: String parameter problem

Posted by Andrey Rogov <an...@gmail.com>.
hi ,
turn on Log4j and look at the sql statement, prepare, parameter and query
result .



2009/7/7 Cax <ca...@gmail.com>

>
> hello, I got a problem in iBatis, i hope somebody could help me...
> i hit problem when i pass in a parameter which the data type is string, and
> the field length in database is 19 char. But,it throws exception because
> the
> returned object is null. and then i try to change the WHERE clause
> condition,to based on other field which the data type is number,and it
> works...
> i want to know what is the problem,is the string value too long or what?
>
> below is my code example :
>
> <select id="selectAccountById" parameterClass="Account"
> resultClass="Account">
>    select
>      PX_IR025_PAN as pan,
>      F9_IR025_CRN as CRN,
>      FX_IR025_EMB_NAME as name,
>      FX_IR025_CRD_PGM as crdPgm,
>      FX_IR025_UPD_UID as updId
>    from IR025
>    where PX_IR025_PAN = #pan#
> </select>
>
>
> in java:
>
> Account acc = new Account();
>
> acc.setpan("1234567890123456");
>
> acc = (Account) sqlMapper.queryForObject("selectAccountById", acc);
> //(Note : return null)
> System.out.println("  " + acc.getname());
>
>
> Thanks before for your help....:-)
>
>
>
> --
> View this message in context:
> http://www.nabble.com/String-parameter-problem-tp24370405p24370405.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>