ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheshadri Patel <meeturpa...@gmail.com>
Subject Re: Association/Inbed Object question
Date Sat, 26 Nov 2005 06:26:24 GMT
Hi,

 #handleby.id# will be treated as getHandleby().getId().

So use either #handleby# or #id# in the query mapping statement and map the
fields in the insert statement correctly.

<insert id="insertAccount" parameterClass="account">
insert into ACCOUNT (ID,NAME, DEPOSITE, FK_HANDLEBY)
values (#id#, #name#, #deposit#, #handleby#)
</insert>

Tx,

Spatel.
On 11/26/05, Alex Chew <chew.alex@gmail.com> wrote:
>
> Hi, Clinton
>
>    Would you please take a look at following message? i could not find any
> clues from ibatis example and docs.
> Does #handleby.id# will be treated as getHandleby().getId()?
> IF not, then, how can i create an Account with handleby User specified?
> Must i try insert and update at the same time?
>
> regards,
> alex
>
> On 11/19/05, Alex Chew < chew.alex@gmail.com> wrote:
> >
> >  Hi, all
> >  would you please help me for following issue, thanks advance.
> >
> >  POJO:
> > public class Account implements Serializable {
> >  private Long id;
> >  private String name;
> > private Double deposit;
> >  private User handleby;
> > }
> >  public class User implements Serializable {
> >  private Long id;
> >  private String username;
> > private String password;
> > }
> >
> >  SQL:
> >  <insert id="insertAccount" parameterClass="account">
> > insert into ACCOUNT (ID,NAME, DEPOSITE, FK_HANDLEBY)
> > values (#id#, #name#, #deposit#, #handleby.id#)
> > </insert>
> >
> > *handleby.id* cannot work,the value inserted is NULL, and no other
> > excpetion message.
> > Must i get id of handleby User manually?
> >
> > regards
> > Alex
> >
>

Mime
View raw message