Hi Clinton,
Issue is resolved. It turns out that I have to specify the javaType.
Perhaps this was only required because I'm using an embedded database;
but it works now.
For someone else who may come across this same issue:
@Insert( "insert into pet( pet_id, name, breed ) values ( #{ petID,
javaType=Long, jdbcType=BIGINT }, #{ name }, #{ breed } )
public void insertPet( @Param("petID") Long petID, @Param("name")
String name, @Param("breed") String breed );
Thanks anyways.
On Nov 17, 11:17 pm, Clinton Begin <
clinton.be...@gmail.com> wrote:
> It won't be the JDBC type that's the problem.
>
> Can you submit a simple unit test that demonstrates the problem?
>
> Cheers,
> Clinton
>
>
>
> On Wed, Nov 17, 2010 at 3:59 PM, Shannon <
liveitha...@gmail.com> wrote:
> > Hello,
> > I'm trying to insert a Long value (pet_id) into a pet table which has
> > the ID defined as a NUMERIC(28). When I execute my unit test, I get
> > the following error:
>
> > java.lang.ClassCastException: java.lang.Integer
> > at $Proxy19.insertPet(Unknown Source)
> > at
>
> > com.petstore.framework.datamanagement.dataaccess.PetDAO.insertRecord(PetDAO.java:
> > 78)
> > at
>
> >
com.petstore.framework.datamanagement.dataaccess.mapper.PetDAOMapperTest.insertRecord_Valid(PetDAOMapperTest.java:
> > 123)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > ...
>
> > the values I am tring to insert: 5, Fido, Bull Dog
>
> > I have a pet table, defined as follows:
>
> > create table(
> > pet_id numeric(28),
> > name varchar(10),
> > breed varchar(20) );
>
> > mapper class:
>
> > @Insert( "insert into pet( pet_id, name, breed ) values ( #{ petID,
> > jdbcType=BIGINT }, #{ name }, #{ breed } )
> > public void insertPet( @Param("petID") Long petID, @Param("name")
> > String name, @Param("breed") String breed );
>
> > I've also tried different jdbcTypes: NUMERIC and DECIMAL; none seem
> > to make a difference.
>
> > Thanks for your help.- Hide quoted text -
>
> - Show quoted text -