Hi all,
I have a 1:many relationship set up between two objects, the one
depending on the other - a newsletter and subscriptions.
When the subscriptions are obtained, castor will join on both tables'
primary keys ( newsletter.id = subscription.id ) instead of (
newsletter.id = subscription.newsletter ) - I am using MySQL.
The following is my setup, and below that the query that is run against
MySQL, which looks wrong - or have I missed some point and my setup is
bogus?
Cheers,
Ben
<class name="test.Newsletter" identity="id" key-generator="IDENTITY">
<map-to table="newsletter"/>
<field name="id" type="integer" required="true">
<sql name="id"/>
</field>
...
<field name="subscriptions"
type="test.Subscription" collection="vector"/>
</class>
<class name="test.Subscription" identity="id" key-generator="IDENTITY"
depends="test.Newsletter">
<map-to table="subscription"/>
<field name="id" type="integer">
<sql name="id" type="numeric"/>
</field>
<field name="newsletter" type="test.Newsletter">
<sql name="newsletter"/>
</field>
...
</class>
and the query that I see in the query log of MySQL is
SELECT
newsletter.topic,
newsletter.return_address,
subscription.id
FROM
newsletter
LEFT OUTER JOIN
subscription
ON
newsletter.id=subscription.id
WHERE
newsletter.id=1
--
Benjamin Peter +49-69-96244395
Application Engineer Moerfelder Landstr. 55
(zentropy:partners) 60598 Frankfurt, Germany
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev