Interesting questions.  I've gotten ejb->DO (1:N) working
fine.  I had a similar conversation on #java the other day.
Since I didn't have an existing database to map to, I did not
define a PK in my DO class.  Orion creates it's own id field
and maps the parent DO pointer to this field.  Every DO in
the parent's Collection is given this id.

As for ordering of Lists, I've haven't tried it.  I'm no
database expert but are databases supposed to guarantee order
upon insertion/selection?  I doubt it.  It sounds like you
did the right thing by adding an ordering field to your DO
table.  The question is, who should be responsible for creating
this field.  Since I don't recall reading anything in the
spec guaranteeing order of Lists, I would imagine it is your
responsibility.  It would be a nice vendor-specific feature
though.

-tim


> -----Original Message-----
> From: Peter Pontbriand [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 09, 2001 10:12 AM
> To: Orion-Interest
> Subject: Re: Complex O/R and EJB 2.0 CMP
> 
> 
> 
> ----- Original Message -----
> From: "Jeff Schnitzer" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Monday, January 08, 2001 4:43 PM
> Subject: RE: Complex O/R and EJB 2.0 CMP
> * SNIP *
> > Take a look at the documentation for orion-ejb-jar.xml; 
> there is a lot
> > you (supposedly) can do that is not yet supported by EJB2.0 
> (like Map
> > and List types).
> 
> Speaking of Lists, has anyone at all managed to get an Orion 
> list-mapping -
> whether declared in a EAR-contained orion-ejb-jar.xml or in a 
> EJB2.0-style
> ejb-jar.xml - to actually preserve the element order?
> 
> Furthermore, has anyone figured out how to prevent Orion's 
> auto-creation of
> database tables from creating a database primary key on the 
> list-mapping
> table that prevents there ever being more than one element in 
> the list? This
> happens with both Orion (1.4.0 & 1.4.4) whenever the parent 
> entity EJB has a
> custom primary key class - Orion adds the EJB primary key 
> fields to the
> list-mapping database table and then creates a database table 
> primary key to
> match these EJB primary key fields. Naturally, trying to add 
> a second list
> element to any instance of the parent EJB means adding 
> another row to this
> table with identical primary key values to an existing row. 
> Voilà, instant
> SqlException from the primary key unique index violation.
> 
> We've resorted to using an extra field in the DO to indicate 
> its index in
> the list, and doing the sorting programmatically in the 
> parent EJB's List
> field accessor method. Having to drop the auto-created table 
> and use our own
> DDL is somewhat less onerous a work-around, but it really shouldn't be
> necessary IMO.
> 
> Is there some secret incantation we're not aware of (one of 
> many I'm sure)
> or is Orion's list-mapping really just a buggy 
> collection-mapping by another
> name?
> 
> P. Pontbriand
> Canlink Interactive Technologies Inc.
> 
> 

Reply via email to