I got a 1:1 working yesterday.  I'm going to sketch out
my object model a little more before I put in a 1:N.  I
don't think Orion supports N:M yet.

With 1:1, the dependent class is mapped onto the same table
as the EJB.  While this looks silly from a database point
of view, its probably the most optimal.  I think you can
play around with the orion-ejb-jar.xml file to map that
dependent class to another table.  The reason I want to
do that is for a reporting tool to grab data from the
database; it's more intuitive if the dependant class is
in another table even if it is a 1:1 relationship.  I
guess I could use DB views though.

The only think I don't like about EJB2 is that dependent
classes are abstract.  Personally, I'd like to be able
to use them in other parts of the client software.  And
their createXXX() methods are not visible on the client
side.  You have to write your own setXXX() with multiple
params.  For example, I have a Contact class with a 
dependent Address class.  I'd like to be able to do this
in the client:

Address a = contact.createAddress();  // NOT LEGAL IN CLIENT
a.setStreet1("123 Anystreet");
...

and have that persist automatically.

Instead I had to write a setAddress() in Contact that took
all the address params.  In the client,

contact.setAddress(street1, street2, city, state, zip,...);

and inside my Contact EJB:

public void setAddress(String street1, String street2,..)
{
   Address a = this.createAddress();
   a.setStreet1(street1);
   ...
   this.setAddress(a);  // MUST DO THIS so dependent object is persisted.
}

Personally, I think this will change before the spec
is finalized.  It's just silly to have to do all that.
The createXXX() methods should be exposed to the
client.

-tim


> -----Original Message-----
> From: Joni [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 20, 2000 12:32 AM
> To: Orion-Interest
> Subject: RE: support EJB2.0 or not?
> 
> 
> On Thu, 19 Oct 2000, Tim Drury wrote:
> 
> > 
> > bing bing bing!!!  you got it right Jeff.  Everything compiles
> > and runs fine now except when I call createAddress() on my EJB
> > to create my Address dependent object, an exception is thrown
> > that the method is not found.  
> 
> <off topic>
> Hey Tim, please let me know if you manage to find out how to specify
> container managed relationships between dependent objects. :)
> E.g. Address->ZipCode (this a stupid example but anyway...)
> </off topic>
> 
> Joni
> [EMAIL PROTECTED]
> 
> 

Reply via email to