ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Mills <developm...@peter.mills.to>
Subject Re: Inserting a complex class
Date Tue, 12 Jun 2007 16:43:12 GMT
Hi everyone,

I've approached the multiple inserts in my DAO, rather than directly in 
the map.   I would create separate insert statements for inserting a 
Customer and inserting a remark.  Then, inside my DAO, I would run the 
insert for the customer, then, foreach remark that the customer has, I 
would run the insert for that remark. 

Cheers,

Peter

Fabrizio Magosso wrote:

> Hi Zheng.
>
> I think that that is the approach of it.
> As you saw, the subclass Remark is a List inside of the Person class,
> so a Person could have 1 or more Remark.
>
> <isNotEmpty property= ???>
>
> This part above is a problem too, because I just cannot use "property"
> to check Null or Empty, given that a property is linked to the class 
> Person
>
>    <statement id="insertPerson" class="Person">
>
> And the Person class has its own properties, that are all different from
> Remarks, and I just don't know how to work with them.
>
> I've been searching and reading on some books, and at the moment, I
> really cannot find something that could help me out on this. :((
>
> But thank you very much for your help :)
>
>
>
>     ------------------------------------------------------------------------
>     Subject: RE: Inserting a complex class
>     Date: Tue, 12 Jun 2007 14:21:21 +0200
>     From: z.wang@alfainfo.fr
>     To: user-cs@ibatis.apache.org
>
>     Hi,
>
>        I’m a freshman too. So i give you what i do. but I don’t know
>     there’s better solution. If there’s better one, please tell me.
>
>        I think you should write
>
>        <statement id="insertPerson" class="Person">
>       insert into PERSON (Id, Name, Surname)
>       values
>       (#Id#, #Name#, #Surname#);
>
>     <dynamic>
>
>                 <isNotEmpty property= ???>
>
>                                        <iterate>
>
>                                                    Insert into
>
>                                        </iterate>
>
>                 </isNotEmpty property= ???>
>
>     </dynamic>
>     </statement>
>
>         But there’s some problem :
>
>     1.       Remark have 2 subclass : RemarkA and RemarkB. And you use
>     table per concret class for mapping(2 talbes one for A one for B).
>     You don’t which table to use.
>
>     2.       I don’t know yet. I’m finding the solution for 1.
>
>        Is this what you want to know?
>
>      
>
>                                                                                     
                                                           
>     WANG Zheng
>
>
> ------------------------------------------------------------------------
> Invite your mail contacts to join your friends list with Windows Live 
> Spaces. It's easy! Try it! 
> <http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us>




Mime
View raw message