I have a similar situation where a unidirectional OneToMany mapping is
needed, such that the target entity ('many' side) does not need to be aware
of the source ('one' side). The target entity, however, requires a
composite primary key with an overlapping foreign key.
It seems that the only way to resolve this is to use a bidirectional
relationship, and put knowledge of the source within the target (and
likewise the source requires knowledge of the target), which is not
desirable.
I'm curious as to whether you found an alternate solution, or if there are
any other recommendations for resolving this.
If the bidirectional relationship is required for JPA, I'd like to minimally
make this transparent to consumers of the class if possible (ie: minimize
the visibility of the required field).
farble1670 wrote:
>
> just fyi, i am not using an existing schema, i am allowing toplink to
> create it for me.
>
> what i did that that seems to work so far is to set up a bidirectional
> relationship. i am not really happy about this though, because really i
> only want the direction to be one way: given a Computer i want to know the
> Ports, but i'd never look up the Computer given a Port.
>
> anyway, thanks!
>
--
View this message in context: http://www.nabble.com/question-about-object-relationships-tf3404296.html#a12485730
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.