You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by ra...@wipro.com on 2006/05/09 06:55:24 UTC

Need help in mapping of one object to Two tables


Hi,

I need to map one Person object to Two tables. Is it possible in Ibatis?

Here i am giving the complete info.

I have one Person Object with both static properties and dynamic
properties.
The static properties are  - id, name,
 the dynamic properties are propertyname, property value.

And i have two tables one to store Person static properties and the 2nd
table is to store dynamic properties.

Following  is the table structure

STATIC_PROP
=================================================
id                                   name
=================================================





DYNAMIC_PROP
==================================================
id                         properyName
propertyValue
===================================================



Now my requirement is to insert one Person object into these two tables.
Is this possible in Ibatis?


Thanks n Regards,
=============================
Rambabu Piridi.




The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Re: Need help in mapping of one object to Two tables

Posted by Rick Reumann <ri...@gmail.com>.
On 5/9/06, rambabu.piridi@wipro.com <ra...@wipro.com> wrote:
>
>
>
> And i have two tables one to store Person static properties and the 2nd
> table is to store dynamic properties.
>
> <snip>
>
> Now my requirement is to insert one Person object into these two tables.
> Is this possible in Ibatis?
>


Since it's two inserts that you need I can't see how you'll get around not
having two insert statements in iBATIS  (I'd call both inserts from a single
transaction so if one fails the rollback occurs).. If you really wanted to
call just one iBATIS insert you could write a stored procedure that does the
two inserts and call that from iBATIS (I'm assuming that would work.)

--
Rick