How to configure onetomany when you refence same sub table twice

0 views
Skip to first unread message

Nuri Cevik

unread,
Apr 14, 2009, 9:41:56 AM4/14/09
to transfer-dev
This is my third day in the learning process of transfer-orm. I wanted
to implement transfer-orm to the mailing application that I already
wrote on mach-ii and coldSpring. I stacked when I'm configuring
transfer.xml

I have a table which I store message and another table that I store
deliveries. I have an column in delivery table which indicates if the
delivery is TO or CC (respectfully 1 and 2).

I would like to get receivers with my message object (which is already
set that way without transfer-orm)

I could not find any method on transfer.xml which could provide me
a - The receivers who are sent as TO
b - Receivers who are sent as CC
as two onetomany connection inside my message object.

Is this possible to do in transfer.xml file?


<package name="message"...>
....
<object name="message"...>
...
<onetomany name="toReceivers">
<!--referencing delivery table with messageID whose
deliveryType is 1-->
</onetomany>

<onetomany name="ccReceivers">
<!--referencing delivery table with messageID whose
deliveryType is 2-->
</onetomany>
</object>

<object name="toReceivers">
<!-- geting deliveries from delivery table which has
deliveryType as 1-->
</object>

<object name="ccReceivers">
<!-- getting deliveries from delivery table which has
deliveryType as 2-->
</object>
</package>


Thanks in advance,

Nuri

Elliott Sprehn

unread,
Apr 14, 2009, 12:13:36 PM4/14/09
to transfer-dev
On Apr 14, 9:41 am, Nuri Cevik <nuri.ce...@gmail.com> wrote:
> I have a table which I store message and another table that I store
> deliveries. I have an column in delivery table which indicates if the
> delivery is TO or CC (respectfully 1 and 2).
>
> I would like to get receivers with my message object (which is already
> set that way without transfer-orm)
>
> I could not find any method on transfer.xml which could provide me
>     a - The receivers who are sent as TO
>     b - Receivers who are sent as CC
> as two onetomany connection inside my message object.
>
> Is this possible to do in transfer.xml file?
>

Seems like you're looking for the <condition> element inside the
<collection> element.
<http://docs.transfer-orm.com/wiki/
Transfer_Configuration_File.cfm#onetomany>

I've not tried this, but I think I'd work.

- Elliott

Chris Peterson

unread,
Apr 14, 2009, 12:22:13 PM4/14/09
to transf...@googlegroups.com
Yup, that's what you need. I have an 'attachment' table which stores
images, or word docs, or whatever. I use conditions to represent that
attachment table based on the attachment type:

<manytomany name="picture" table="xAuctionAttachments" lazy="true"
proxied="true">
<link to="auction" column="auctionID" />
<link to="attachment" column="attachmentID" />
<collection type="array">
<condition property="type" value="image" />
</collection>
</manytomany>

<manytomany name="badge" table="xAuctionAttachments" lazy="true">
<link to="auction" column="auctionID" />
<link to="attachment" column="attachmentID" />
<collection type="array">
<condition property="type" value="badge" />
</collection>
</manytomany>

<manytomany name="thumbnail" table="xAuctionAttachments" lazy="true">
<link to="auction" column="auctionID" />
<link to="attachment" column="attachmentID" />
<collection type="array">
<condition property="type" value="thumb" />
</collection>
</manytomany>

Hth,

Chris Peterson

Cevik, Celettin N.

unread,
Apr 14, 2009, 1:07:53 PM4/14/09
to transf...@googlegroups.com
Awesome,

Thanks a lot Elliot and Chris :)
Reply all
Reply to author
Forward
0 new messages