|
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
|
- RE: Fun with compound primary keys Michael Jara
- RE: Fun with compound primary keys Frank Eggink
- Re: Fun with compound primary keys Michael Jara
- RE: Fun with compound primary keys Jeff Schnitzer
- RE: Fun with compound primary keys Tin Hoc Pt
- RE: Fun with compound primary keys Kemp Randy-W18971
- RE: Fun with compound primary keys Dan North
- RE: Fun with compound primary keys Lauren Commons
