----- Original Message -----
From: "Jeff Schnitzer" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Monday, December 11, 2000 4:57 PM
Subject: RE: EJB2.0 Generated class uncompilable


> FYI, as a workaround, you can make bidirectional relationships work by
> manually setting both sides of the relationship.  Orion currently seems
> to treat a bidirectional relationship as two unidirectional
> relationships, so everything works as long as you update both sides.
>
> Assuming hypothetical entities foo and bar, with a 1->M relationship
> foo->bar, the method Foo.addBar can look like this:
>
> void addBar(Bar bar) // on Foo
> {
> this.getBars().add(bar);
>
> // TODO: Remove this code when bidir relationships work
> try
> {
> bar.setFoo((Foo)ejbContext.getEJBObject());
> }
> catch (java.rmi.RemoteException ex)
> {
> throw new EJBException(ex);
> }
> }
>
> Of course you get data duplication in the database, but it works :-)
>
> Jeff Schnitzer
> [EMAIL PROTECTED]

This makes sense. Lately, I've been thinking using an orion-ejb-jar.xml in
the EAR to map both set-mappings to the same table, setting
exclusive-write-access to false. You idea makes for a simpler change when
Orion does get bidir relationships working.

P. Pontbriand
Canlink Interactive Technologies Inc.




Reply via email to