db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: Setting a 1:1 association with "mapped-by"
Date Wed, 17 May 2006 19:07:14 GMT
Hi Jörg,

you can create an unique index on the FK in the database. This still 
does not automatically update the other side of the relationship. But it 
prevents storing unexpected relationship values into the database, 
because the transaction would fail if a2 still refers b2.

The JDO implementation might support managing bidirectional 
relationships in memory, but this is not mandated by the spec.

Regards Michael

> Eric Samson schrieb:
>>
>> /In particular, I'd expect a2 not pointing to b2 anymore, as this 
>> clearly is supposed to be is a 1:1 relationship. The implementation 
>> can determine this being a 1:1 association, as there are two 
>> corresponding fields, and consequently it should issue /
>>
>>  
>>
>>  
>>
>> Bu default, there is no 1:1 relationships either in Java or in RDBMS.
>>
>> If you want to insure this 1:1 bi-directional link you have to:
>>
>>     * use some triggers in your db
>>     * use a JDO callback
>>     * do it cleanly in your set /getters in Java
>>     * use an ORM tool that can manage 1:1 bi-directional links
>>
> I see. Hm. Well. For this relationship, being "bidirectional" seems to 
> be equivalent to "being 1:1". Confusing.
>
> Anyway, thanks for your answer!
>
> Regards,
> Jörg
>


-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			


Mime
View raw message