Unfortunately, it wasn't quite that simple.  Since I was using CMP, my
ejbCreate was returning 'null' anyway.  If Orion, internally somewhere, was
trying to serialize the primary key class, you would expect that it would
throw an exception or at least kill the entity bean on which it was
performing operations.  In my case, it was killing all references to the
entity beans passed in as parameters!  And it was doing so only after the
first creation of the faulty entity bean (e.g. one was successfully created,
the next one had problems.)

This is, of course, not a bug in Orion.  It's just counter-intuitive
behavior which occurs when the bean developer (me) does something stupid. :)

Mike

----- Original Message -----
From: "Frank Eggink" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Tuesday, May 08, 2001 2:20 PM
Subject: RE: Fun with compound primary keys


> Yep, if you don't make things serializable you get <null> as a 'value'.
> That applies to return values crossing the wire as well :-).
>
> Note that, to prevent yourself from having more fun!
>
> FE
>
> On Tuesday, May 08, 2001 2:43 AM, Michael Jara
> [SMTP:[EMAIL PROTECTED]] wrote:
> > It took me a while to figure this out, so I thought I'd post it.
> >
> > If you are using a compound primary key class in your CMP entity bean,
> and you forget to make it implement java.io.Serializable, Orion may do
some
> really strange things.
> >
> > In my case, I have an entity bean which represents a many to many
mapping
> of other entity beans, called "TypeDescriptionPair".  This entity bean's
> create method took two other entity beans as parameters, "EventType" and
> "EventDescription".  The create method would simply extract the primary
key
> from each of these and store it.  So, I was doing something like this to
> test the implementation:
> >
> > ...
> > eventTypes[0] = eventTypeHome.create(0, "eventType0");
> > eventTypes[1] = eventTypeHome.create(1, "eventType1");
> > ...
> > eventDescription[0] = eventTypeHome.create(0, "eventDescription0");
> > eventDescription[1] = eventTypeHome.create(1, "eventDescription1");
> > ...
> > typeDescriptionPairHome.create(eventTypes[0], eventDescription[0]);
> > typeDescriptionPairHome.create(eventTypes[1], eventDescription[1]);
> >
> > The very last statement would throw a CreateException, because all
> EventType and EventDescription remote objects had mysteriously been
> nullified!  After hours of debugging, I realized that
> "TypeDescriptionPair"s primary key class did not implement
> java.io.Serializable.  As soon as I added "implements java.io.Serailzable"
> to the primary key class, everything was magically fixed.
> >
> > Mike
> >  << File: ATT00003.html >>
>


Reply via email to