Re: IBatis2.3.4 throws : java.sql.SQLException: Invalid column type when property is not set in POJO while inserting data.

2010-02-02 Thread Jeff Butler
VARCHAR2 and NUMBER are not valid JDBC types.  These are Oracle
specific.  You need to specify the correct JDBC equivalent.  See here
for the valid values:

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Types.html

Also, if you use a declared parameter map, then you must change the
parameter markers to question marks.

Jeff Butler


On Tue, Feb 2, 2010 at 2:03 AM, rajnishp  wrote:
>
> Thanks Clinton,
>
> Larry FYI my SqlMAp for insert is like
>  parameterClass="com.sungard.cliq.dto.AllocationDTO" >
>                
>                        SELECT ALLOCATION_INSTRUCTION_SEQ.NextVal FROM DUAL
>                
>
>                INSERT INTO ALLOCATION_INSTRUCTION
>                (
>                ALLOCATION_INSTRUCTION_ID,
>                CLEARING_BROKER,
>                EXTERNAL_ACCOUNT_ID,
>                ACCOUNT_NAME,
>                ACCOUNT_ID,
>                QUANTITY,
>                PRICE,
>                USER_LOGIN_NAME,
>                USER_ID,
>                ENTITY_ID,
>                CREATED_BY
>                )
>                VALUES
>                (
>                #allocationID# ,
>                #clearingBroker# ,
>                #externalAccountID#,
>                #accountName#,
>                #accountID#,
>                #quantity#,
>                #price#,
>                #userLoginName#,
>                #userID:NUMBER#,
>                #entityID#,
>                #createdBy#
>                )
>
> here I have set Inline parameter for userID as NUMBER
>
> But still it is throwing same exception, when we looked in issue we found it
> was working fine with primitives int ,long, double and String but it was
> throwing same exception with wrappers of Integer, Long, Double.
> For our requirement POJO uses Wrappers attributes.
>
> I also tried to resolve this issue by using parameterMap
>
>  class="com.sungard.cliq.dto.AllocationDTO">
>  jdbcType="NUMBER"/>
>  jdbcType="VARCHAR2"/>
>  jdbcType="VARCHAR2"/>
>  jdbcType="VARCHAR2"/>
>  jdbcType="NUMBER"/>
>  jdbcType="NUMBER"/>
>  jdbcType="NUMBER"/>
>  jdbcType="VARCHAR2"/>
>  jdbcType="NUMBER"/>
>  jdbcType="NUMBER"/>
>  jdbcType="VARCHAR2"/>
> 
>
>
>  parameterClass="com.sungard.cliq.dto.AllocationDTO"
> parameterMap="insertAllocationInstructionParameterMap">
>                
>                        SELECT ALLOCATION_INSTRUCTION_SEQ.NextVal FROM DUAL
>                
>
>                INSERT INTO ALLOCATION_INSTRUCTION
>                (
>                ALLOCATION_INSTRUCTION_ID,
>                CLEARING_BROKER,
>                EXTERNAL_ACCOUNT_ID,
>                ACCOUNT_NAME,
>                ACCOUNT_ID,
>                QUANTITY,
>                PRICE,
>                USER_LOGIN_NAME,
>                USER_ID,
>                ENTITY_ID,
>                CREATED_BY
>                )
>                VALUES
>                (
>                #allocationID# ,
>                #clearingBroker# ,
>                #externalAccountID#,
>                #accountName#,
>                #accountID#,
>                #quantity#,
>                #price#,
>                #userLoginName#,
>                #userID#,
>                #entityID#,
>                #createdBy#
>                )
>
> But stiil it is giving
>
> java.sql.BatchUpdateException: ORA-00911: invalid character
>
>
>
> Clinton Begin wrote:
>>
>> Using null value replacement like #id:NUMERIC:-99# doesn't act like a
>> default value.  In fact, it acts quite the opposite way.  It was
>> originally
>> implemented to allow nullable fields in the database to be mapped to
>> primitive Java types (non-nullable).  Because it was so hard to
>> understand,
>> it's been removed in iBATIS 3.
>>
>> So, that won't help you.
>>
>> Based on your comment and without your code, it seems to me you're asking
>> how to avoid a SQL exception when you don't pass in a parameter.
>> Unfortunately, you have to pass in every parameter that you specify.  You
>> would get the same error with plain JDBC.
>>
>> Clinton
>>
>> On Mon, Feb 1, 2010 at 2:51 AM, rajnishp  wrote:
>>
>>>
>>> Hi,
>>> IBatis throws SQL exception while inserting data using InlineParameterMap
>>> :--
>>>
>>> The error occurred while applying a parameter map.
>>> --- Check the insertAllocationInstruction-InlineParameterMap.
>>> --- Check the parameter mapping for the 'userID' property.
>>> --- Cause: java.sql.SQLException: Invalid column type
>>>
>>> Ibatis throws error because the attribute userID is not set while
>>> inserting
>>> data in database(Oracle 10g).
>>> After doing googling I got help in
>>> http://ibatisnet.sourceforge.net/DevGuide.html
>>> Solution provided :--
>>>                      >> parameterClass=”product”>
>>>                       insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
>>>                      values (#id:NUMERIC:-99#,
>>> #description:VARCHAR:NO_ENTRY#);
>>>                      
>>> Providing Default value if attribut not set.
>>>
>>> This solution is not work

Re: IBatis2.3.4 throws : java.sql.SQLException: Invalid column type when property is not set in POJO while inserting data.

2010-02-02 Thread rajnishp

Thanks Clinton,

Larry FYI my SqlMAp for insert is like


SELECT ALLOCATION_INSTRUCTION_SEQ.NextVal FROM DUAL


INSERT INTO ALLOCATION_INSTRUCTION 
(
ALLOCATION_INSTRUCTION_ID, 
CLEARING_BROKER,
EXTERNAL_ACCOUNT_ID,
ACCOUNT_NAME,
ACCOUNT_ID,
QUANTITY,   
PRICE,  
USER_LOGIN_NAME,
USER_ID,
ENTITY_ID,  
CREATED_BY  
) 
VALUES 
( 
#allocationID# , 
#clearingBroker# ,
#externalAccountID#,
#accountName#,  
#accountID#,
#quantity#, 
#price#,
#userLoginName#,
#userID:NUMBER#,
#entityID#, 
#createdBy#
)

here I have set Inline parameter for userID as NUMBER

But still it is throwing same exception, when we looked in issue we found it
was working fine with primitives int ,long, double and String but it was
throwing same exception with wrappers of Integer, Long, Double.
For our requirement POJO uses Wrappers attributes.

I also tried to resolve this issue by using parameterMap 


















SELECT ALLOCATION_INSTRUCTION_SEQ.NextVal FROM DUAL


INSERT INTO ALLOCATION_INSTRUCTION 
(
ALLOCATION_INSTRUCTION_ID, 
CLEARING_BROKER,
EXTERNAL_ACCOUNT_ID,
ACCOUNT_NAME,
ACCOUNT_ID,
QUANTITY,   
PRICE,  
USER_LOGIN_NAME,
USER_ID,
ENTITY_ID,  
CREATED_BY  
) 
VALUES 
( 
#allocationID# , 
#clearingBroker# ,
#externalAccountID#,
#accountName#,  
#accountID#,
#quantity#, 
#price#,
#userLoginName#,
#userID#,
#entityID#, 
#createdBy#
)

But stiil it is giving 

java.sql.BatchUpdateException: ORA-00911: invalid character



Clinton Begin wrote:
> 
> Using null value replacement like #id:NUMERIC:-99# doesn't act like a
> default value.  In fact, it acts quite the opposite way.  It was
> originally
> implemented to allow nullable fields in the database to be mapped to
> primitive Java types (non-nullable).  Because it was so hard to
> understand,
> it's been removed in iBATIS 3.
> 
> So, that won't help you.
> 
> Based on your comment and without your code, it seems to me you're asking
> how to avoid a SQL exception when you don't pass in a parameter.
> Unfortunately, you have to pass in every parameter that you specify.  You
> would get the same error with plain JDBC.
> 
> Clinton
> 
> On Mon, Feb 1, 2010 at 2:51 AM, rajnishp  wrote:
> 
>>
>> Hi,
>> IBatis throws SQL exception while inserting data using InlineParameterMap
>> :--
>>
>> The error occurred while applying a parameter map.
>> --- Check the insertAllocationInstruction-InlineParameterMap.
>> --- Check the parameter mapping for the 'userID' property.
>> --- Cause: java.sql.SQLException: Invalid column type
>>
>> Ibatis throws error because the attribute userID is not set while
>> inserting
>> data in database(Oracle 10g).
>> After doing googling I got help in
>> http://ibatisnet.sourceforge.net/DevGuide.html
>> Solution provided :--
>>  > parameterClass=”product”>
>>   insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
>>  values (#id:NUMERIC:-99#,
>> #description:VARCHAR:NO_ENTRY#);
>>  
>> Providing Default value if attribut not set.
>>
>> This solution is not working.
>>
>> Please provided correct solution solution (Only by IBatis not setting
>> default value in POJO)
>>
>> Thanking In Advance.
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/IBatis2.3.4-throws-%3A-java.sql.SQLException%3A-Invalid-column-type-when-property-is-not-set-in-POJO-while-inserting-data.-tp27401733p27401733.html
>> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
>> For additional commands, e-mail: dev-h...@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/IBatis2.3.4-throws-%3A-java.sql.SQLException%3A-Invalid-column-type-when-property-is-not-set-in-POJO-while-in

Re: IBatis2.3.4 throws : java.sql.SQLException: Invalid column type when property is not set in POJO while inserting data.

2010-02-01 Thread Clinton Begin
Using null value replacement like #id:NUMERIC:-99# doesn't act like a
default value.  In fact, it acts quite the opposite way.  It was originally
implemented to allow nullable fields in the database to be mapped to
primitive Java types (non-nullable).  Because it was so hard to understand,
it's been removed in iBATIS 3.

So, that won't help you.

Based on your comment and without your code, it seems to me you're asking
how to avoid a SQL exception when you don't pass in a parameter.
Unfortunately, you have to pass in every parameter that you specify.  You
would get the same error with plain JDBC.

Clinton

On Mon, Feb 1, 2010 at 2:51 AM, rajnishp  wrote:

>
> Hi,
> IBatis throws SQL exception while inserting data using InlineParameterMap
> :--
>
> The error occurred while applying a parameter map.
> --- Check the insertAllocationInstruction-InlineParameterMap.
> --- Check the parameter mapping for the 'userID' property.
> --- Cause: java.sql.SQLException: Invalid column type
>
> Ibatis throws error because the attribute userID is not set while inserting
> data in database(Oracle 10g).
> After doing googling I got help in
> http://ibatisnet.sourceforge.net/DevGuide.html
> Solution provided :--
>   parameterClass=”product”>
>   insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
>  values (#id:NUMERIC:-99#,
> #description:VARCHAR:NO_ENTRY#);
>  
> Providing Default value if attribut not set.
>
> This solution is not working.
>
> Please provided correct solution solution (Only by IBatis not setting
> default value in POJO)
>
> Thanking In Advance.
>
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/IBatis2.3.4-throws-%3A-java.sql.SQLException%3A-Invalid-column-type-when-property-is-not-set-in-POJO-while-inserting-data.-tp27401733p27401733.html
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: dev-h...@ibatis.apache.org
>
>


Re: IBatis2.3.4 throws : java.sql.SQLException: Invalid column type when property is not set in POJO while inserting data.

2010-02-01 Thread Larry Meadors
Your code would be useful. The code from the dev guide...not so much. :)

Larry


On Mon, Feb 1, 2010 at 2:51 AM, rajnishp  wrote:
>
> Hi,
> IBatis throws SQL exception while inserting data using InlineParameterMap
> :--
>
> The error occurred while applying a parameter map.
> --- Check the insertAllocationInstruction-InlineParameterMap.
> --- Check the parameter mapping for the 'userID' property.
> --- Cause: java.sql.SQLException: Invalid column type
>
> Ibatis throws error because the attribute userID is not set while inserting
> data in database(Oracle 10g).
> After doing googling I got help in
> http://ibatisnet.sourceforge.net/DevGuide.html
> Solution provided :--
>                       parameterClass=”product”>
>                       insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
>                      values (#id:NUMERIC:-99#,
> #description:VARCHAR:NO_ENTRY#);
>                      
> Providing Default value if attribut not set.
>
> This solution is not working.
>
> Please provided correct solution solution (Only by IBatis not setting
> default value in POJO)
>
> Thanking In Advance.
>
>
>
>
>
> --
> View this message in context: 
> http://old.nabble.com/IBatis2.3.4-throws-%3A-java.sql.SQLException%3A-Invalid-column-type-when-property-is-not-set-in-POJO-while-inserting-data.-tp27401733p27401733.html
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: dev-h...@ibatis.apache.org
>
>

-
To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
For additional commands, e-mail: dev-h...@ibatis.apache.org