You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Emmanuel Bardet <em...@bardet.org> on 2002/01/31 12:20:30 UTC

BasePeer inserts "0" in place of my value

This is following my previous message further down.

For some reason, the function BasePeer.doInsert doesn't save one field with
the given value and returns a funny primary key which causes an exception
further later the code. I would be very grateful if the developpers could
help me on this one.

Thanks.

Emmanuel.

> -----Original Message-----
> From: Emmanuel Bardet [mailto:emmanuel@bardet.org]
> Sent: mercredi 30 janvier 2002 22:58
> To: Turbine Users List
> Subject: Insert -> ClassCastException: BigDecimal
>
>
> Hello folks,
>
> Bizarre. I get a BigDecimal class cast exception whereas I do not
> deal with
> BigDecimal on this table.
>
> My table is as following:
>
>   <table name="RECIPE_LANGUAGE_DESCRIPTION">
>     <column name="RECIPE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="LANGUAGE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="DESCRIPTION" type="LONGVARCHAR"/>
>
>     <foreign-key foreignTable="RECIPE">
>         <reference local="RECIPE_ID" foreign="RECIPE_ID"/>
>     </foreign-key>
>     <foreign-key foreignTable="LANGUAGE">
>         <reference local="LANGUAGE_ID" foreign="LANGUAGE_ID"/>
>     </foreign-key>
>   </table>
>
> My code is:
>
> RecipeLanguageDescription t = new RecipeLanguageDescription();
> t.setRecipeId( "140" );
> t.setLanguageId( "120" );
> t.setDescription( "TEST" );
>
> RecipeLanguageDescriptionPeer.doInsert( t );
>
> And I get:
>
> [Wed Jan 30 22:29:02 GMT 2002] -- ERROR --
> 	Exception:  java.lang.ClassCastException: java.math.BigDecimal
> 	Stack Trace follows:
> 	java.lang.ClassCastException: java.math.BigDecimal
> 	at
> com.mctar.menu.om.BaseTarMenuRecipeLanguageDescription.setPrimaryK
> ey(BaseRec
> ipeLanguageDescription.java:398)
> 	at
> com.mctar.menu.om.BaseTarMenuRecipeLanguageDescriptionPeer.doInser
> t(BaseReci
> peLanguageDescriptionPeer.java:308)
> 	at
> com.mctar.modules.actions.admin.RecipeUpdateAction.insertEntity(Re
> cipeUpdate
> Action.java:182)
>
> With '0', '120', 'TEST' in my DB!!!
>
> I must admit I do not really understand what's going on here.
> Could anybody
> help please ?
>
> Thanks,
>
> Emmanuel.
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: BasePeer inserts "0" in place of my value

Posted by John McNally <jm...@collab.net>.
You should set the property idMethod="none" on the <table>

john mcnally

Emmanuel Bardet wrote:
> 
> This is following my previous message further down.
> 
> For some reason, the function BasePeer.doInsert doesn't save one field with
> the given value and returns a funny primary key which causes an exception
> further later the code. I would be very grateful if the developpers could
> help me on this one.
> 
> Thanks.
> 
> Emmanuel.
> 
> > -----Original Message-----
> > From: Emmanuel Bardet [mailto:emmanuel@bardet.org]
> > Sent: mercredi 30 janvier 2002 22:58
> > To: Turbine Users List
> > Subject: Insert -> ClassCastException: BigDecimal
> >
> >
> > Hello folks,
> >
> > Bizarre. I get a BigDecimal class cast exception whereas I do not
> > deal with
> > BigDecimal on this table.
> >
> > My table is as following:
> >
> >   <table name="RECIPE_LANGUAGE_DESCRIPTION">
> >     <column name="RECIPE_ID" required="true" primaryKey="true"
> > type="INTEGER"/>
> >     <column name="LANGUAGE_ID" required="true" primaryKey="true"
> > type="INTEGER"/>
> >     <column name="DESCRIPTION" type="LONGVARCHAR"/>
> >
> >     <foreign-key foreignTable="RECIPE">
> >         <reference local="RECIPE_ID" foreign="RECIPE_ID"/>
> >     </foreign-key>
> >     <foreign-key foreignTable="LANGUAGE">
> >         <reference local="LANGUAGE_ID" foreign="LANGUAGE_ID"/>
> >     </foreign-key>
> >   </table>
> >
> > My code is:
> >
> > RecipeLanguageDescription t = new RecipeLanguageDescription();
> > t.setRecipeId( "140" );
> > t.setLanguageId( "120" );
> > t.setDescription( "TEST" );
> >
> > RecipeLanguageDescriptionPeer.doInsert( t );
> >
> > And I get:
> >
> > [Wed Jan 30 22:29:02 GMT 2002] -- ERROR --
> >       Exception:  java.lang.ClassCastException: java.math.BigDecimal
> >       Stack Trace follows:
> >       java.lang.ClassCastException: java.math.BigDecimal
> >       at
> > com.mctar.menu.om.BaseTarMenuRecipeLanguageDescription.setPrimaryK
> > ey(BaseRec
> > ipeLanguageDescription.java:398)
> >       at
> > com.mctar.menu.om.BaseTarMenuRecipeLanguageDescriptionPeer.doInser
> > t(BaseReci
> > peLanguageDescriptionPeer.java:308)
> >       at
> > com.mctar.modules.actions.admin.RecipeUpdateAction.insertEntity(Re
> > cipeUpdate
> > Action.java:182)
> >
> > With '0', '120', 'TEST' in my DB!!!
> >
> > I must admit I do not really understand what's going on here.
> > Could anybody
> > help please ?
> >
> > Thanks,
> >
> > Emmanuel.
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>