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
De : Fabrizio Magosso [mailto:[EMAIL PROTECTED]
Envoyé : mardi 12 juin 2007 14:12
À : [email protected]
Objet : Inserting a complex class
Hello all.
I'm new with iBatis and I'm having trouble inserting a complex class to the
database.
For example, I would like to insert the following class:
+ Person -----> Remark
Id Id
Name Text
Surname
Given that the class "Person" has a List<Remark>, I'd like to create a insert
statement
on the SQL Map.
<statement id="insertPerson" class="???"> * I don't know which class. Person or
Remark???
insert into PERSON (Id, Name, Surname)
values
(#Id#, #Name#, #Surname#);
</statement>
And so... Where and when do I create the Remark insert statement ??
Maybe I'm doing something wrong or even started on the wrong way of thinking,
so I'd
like someone to give me a hint, if possible.
Thank you all.
Regards,
Fabrizio
________________________________
Get news, entertainment and everything you care about at Live.com. Check it
out! <http://www.live.com/getstarted.aspx%20>