ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: invalid column type
Date Wed, 27 Apr 2005 14:45:38 GMT
You don't NEED null value replacements, just the type. So this would be 
fine:

<statement id="insertProduct" parameterClass="com.domain.Product"> 
insert into PRODUCT (PRD_ID, PRD_DESCRIPTION) 
values (#id:NUMERIC#,
#description:VARCHAR#); 
</statement> 

This is an Oracle requirement supported by the standard JDBC intereface. The 
method signature for setting null values is:

public void setNull(int parameterIndex,
                    int sqlType)
             throws SQLException
<http://java.sun.com/j2se/1.4.2/docs/api/java/sql/SQLException.html>


Cheers,
Clinton

On 4/27/05, Jason Punzalan <jasonpunzalan@gmail.com> wrote:
> I noticed that when using the same maps with oracle i need to declare the
> types and null value replacements in my inline parameter. not sure why
> though...from the dev handbook...
> 
> <statement id="insertProduct" parameterClass="com.domain.Product"> 
> insert into PRODUCT (PRD_ID, PRD_DESCRIPTION) 
> values (#id:NUMERIC:-999999#,
> #description:VARCHAR:NO_ENTRY#); 
> </statement> 
> 
> 
> 
> On 4/27/05, Daniel H. F. e Silva <dhfs@yahoo.com> wrote:
> > Hi Jason,
> > 
> > According to the stack trace you've posted, i would say that you are
> facing problems with data
> > type conversions done by your JDBC driver.
> > I guess your 'isFeature' property is a boolean value and your table 
column
> 'isFeature' is of 
> > another type?
> > If so, i faced this problem before: my java objects held boolean values
> and my database columns
> > used to hold varchar2(1) values as 'Y', 'N' or 'T', 'F'.
> > If all i mentioned above is your current situation, my advise is: write 
a
> CTH (Custom Type 
> > Handler). The iBatis Wiki has some nice details about this issue.
> > 
> > Hope that helped.
> > 
> > Cheers,
> > Daniel Silva.
> > 
> > 
> > --- Jason Punzalan <jasonpunzalan@gmail.com > wrote:
> > > this works on mysql but not on oracle. same table layout. any ideas?
> > >
> > > <insert id="insertContent" parameterClass="Content" >
> > > <![CDATA[ 
> > > insert into content(publication, modified_by,
> priority, source,
> > > type_id, body, id, subtitle, title, isFeature, modified, summary,
> > > page_id, enabled, created_by, created, status, sub_type)
> > > values(#publication#, #modifiedBy#, #priority#,
> #source#, #typeId#,
> > > #body#, #id#, #subtitle#, #title#, #isfeature#, now(), #summary#,
> > > #pageId#, #enabled#, #createdBy#, now(), "draft", #subType.id#) 
> > > ]]>
> > > </insert>
> > >
> > >
> > >
> > > org.springframework.jdbc.UncategorizedSQLException:
> (SqlMapClient
> > > operation): encountered SQLException [
> > > --- The error occurred in com/ruderfinn/maps/Content.xml. 
> > > --- The error occurred while applying a parameter map.
> > > --- Check the insertContent-InlineParameterMap.
> > > --- Check the parameter mapping for the 'isfeature' property.
> > > --- Cause: java.sql.SQLException : Invalid column type]; nested
> > > exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
> > > --- The error occurred in com/ruderfinn/maps/Content.xml.
> > > --- The error occurred while applying a parameter map. 
> > > --- Check the insertContent-InlineParameterMap.
> > > --- Check the parameter mapping for the 'isfeature' property.
> > > --- Cause: java.sql.SQLException: Invalid column type
> > > com.ibatis.common.jdbc.exception.NestedSQLException :
> > > --- The error occurred in com/ruderfinn/maps/Content.xml.
> > > --- The error occurred while applying a parameter map.
> > > --- Check the insertContent-InlineParameterMap.
> > > --- Check the parameter mapping for the 'isfeature' property. 
> > > --- Cause: java.sql.SQLException: Invalid column type
> > > Caused by: java.sql.SQLException: Invalid column type
> > >
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com
> > 
> 
>

Mime
View raw message