ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chew <chew.a...@gmail.com>
Subject Re: how can i get attribute from inbed object?
Date Wed, 23 Nov 2005 08:55:59 GMT
Do you mean there should have such a field like
     private Long handlebyId;
and i should prepare the data?
It seems some strange.

>  <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.

>  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>

Mime
View raw message