You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Jean-François Smigielski <jf...@gmail.com> on 2007/12/01 02:50:50 UTC
Relationship inspection
Hello, list!
I am using Cayenne 3.0M1 on top of a Sun JVM 6.0 (I vote for java 1.5 at
least support:).
Is it possible to determine, from the application point of view, if the
to-one side of a "1-*" relationship accept NULL values?
--
JF Smigielski
Re: Relationship inspection
Posted by Andrus Adamchik <an...@objectstyle.org>.
There's no direct API to achieve that, but you can still figure it
from mapping metadata. Check whether a DbAttribute on the to-many side
of the relationship (i.e. the foreign key) allows null. There are a
few exceptions from this rule [1], but generally this should be an
indicator of whether a given to-one is optional.
You can get access to the mapping metadata in runtime via
context.getEntityResolver().
Andrus
[1] http://objectstyle.org/cayenne/lists/cayenne-user/2007/11/0097.html
On Dec 1, 2007, at 3:50 AM, Jean-François Smigielski wrote:
> Hello, list!
>
> I am using Cayenne 3.0M1 on top of a Sun JVM 6.0 (I vote for java
> 1.5 at
> least support:).
>
> Is it possible to determine, from the application point of view, if
> the
> to-one side of a "1-*" relationship accept NULL values?
>
> --
> JF Smigielski