ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Campbell <michael.campb...@gmail.com>
Subject Re: how can i get attribute from inbed object?
Date Wed, 23 Nov 2005 16:50:58 GMT
On 11/23/05, Alex Chew <chew.alex@gmail.com> wrote:
>
>
> Do you mean there should have such a field like
>      private Long handlebyId;
> and i should prepare the data?
> It seems some strange.

Yes, I misunderstood your initial question.  My apologies.  See below.


>
> >  <insert id=3D"insertAccount" parameterClass=3D"account">
> > insert into ACCOUNT (ID,NAME, DEPOSITE, FK_HANDLEBY)
> > values (#id#, #name#, #deposit#, #handleby.id#)
> > </insert>
>
> in my opinion, handleby.id here  should be explained as
> getHandleby().getId().
> The process will be handled by iBatis, not Database.

You're right.  your POJO's attribute is not "handleby", however, but
"handledby" (note the extra letter "d").   Is that the issue perhaps?


>
> >  POJO:
> > public class Account implements Serializable {
> >  private Long id;
> >  private String name;
> > private Double deposit;
> >  private User handledby;
> > }
> >  public class User implements Serializable {
> >  private Long id;
> >  private String username;
> > private String password;
> > }
> >
> >  SQL:
> >  <insert id=3D"insertAccount" parameterClass=3D"account">
>  > insert into ACCOUNT (ID,NAME, DEPOSITE, FK_HANDLEBY)
> > values (#id#, #name#, #deposit#, #handleby.id#)
> > </insert>
>


--
I tend to view "truly flexible" by another term: "Make everything
equally hard". -- DHH

Mime
View raw message