"Houston we have a problem..."
I have a One-Many relation (See below) between an exercise and a result bean:
As I set an relation on a bean (Result), that has relations to another bean (Exercise), I get the following error:
javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=ep.exercises.ExerciseEJBPK@31
But the entity is actually there. That I know since I write the name of it just on the line before.
The code looks like this:
//The exercise is found:
exercise = ...Found via the collection of a third bean.
//The exerciseResult is initialized:
exerciseResult = ...
System.out.println("Name: "+exercise.getName());
exerciseResult.setExercise(exercise);
The last line courses the failure.
The output of this is typically:
>>Name: Testopgave 1
>>TransactionRolledbackLocalException, causedBy:
>>javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=ep.exercises.ExerciseEJBPK@31
I stripped the message for not nessecary parts.
Why does this failure arise?
Morten Andersen
I run on Jboss 3.0.1
My relation between the two beans is deployed as:
<ejb-relation>
<ejb-relation-name>Result-Exercise</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Result-to-Exercise
</ejb-relationship-role-name>
Many
<cascade-delete />
<relationship-role-source><ejb-name>Result
</ejb-name></relationship-role-source>
<cmr-field>
<cmr-field-name>exercise</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Exercise-to-Result
</ejb-relationship-role-name>
One
<relationship-role-source><ejb-name>Student
</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>