You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "shh... ." <pr...@yahoo.com> on 2002/07/05 18:29:20 UTC

tdk2.2, decoupled torque, mysql problem

I'm trying to insert a row, but for some reason torque
is not inserting a value for the primary key. The
schema and source code are below. It seems that
ItemPeer builds a Criteria internally, but item_number
is not added to criteria because item.isNew() == true;
Is this expected behavior?

<database name="shopper">
  <table name="item" idMethod="native">
    <column name="item_number" 
		size="255"
		required="true" 
		primaryKey="true"
		type="VARCHAR"/>
    ...
    ...
   </table>
</database>

Item item = new Item();
item.setItemNumber("12345");
ItemPeer.doInsert(item);





__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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


Re: tdk2.2, decoupled torque, mysql problem

Posted by Michael Young <pr...@yahoo.com>.
i've found a workaround, but i don't think that's
right. before i call item.doInsert(), i call
item.setNew(false). This works, but my item really is
new. Can someone shed some light?


--- "shh... ." <pr...@yahoo.com> wrote:
> I'm trying to insert a row, but for some reason
> torque
> is not inserting a value for the primary key. The
> schema and source code are below. It seems that
> ItemPeer builds a Criteria internally, but
> item_number
> is not added to criteria because item.isNew() ==
> true;
> Is this expected behavior?
> 
> <database name="shopper">
>   <table name="item" idMethod="native">
>     <column name="item_number" 
> 		size="255"
> 		required="true" 
> 		primaryKey="true"
> 		type="VARCHAR"/>
>     ...
>     ...
>    </table>
> </database>
> 
> Item item = new Item();
> item.setItemNumber("12345");
> ItemPeer.doInsert(item);
> 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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