You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Ravi P Palacherla <ra...@oracle.com> on 2010/02/05 19:44:47 UTC

Purpose of SubclassJoinDiscriminatorStrategy.getClassConditions()

Hi,

What is the purpose of getClassConditions methog of
SubclassJoinDiscriminatorStrategy ?

All it does is to add 'IS NULL' condition to all the subclasses.

This is causing a problem in the following scenario:

MountainBike and RacingBike extends Bicycle. Bicycle extends Vehicle.

All are entities and Inheritance strategy is InheritanceType.JOINED on all
the above classes.
None of them has discrimatorycolumn.

I persist Bicycle.
After persisting, I try to retrieve Bicycle by em.find then it returns
ObjectNotFound exception.

Reason is because the query contains :

select <<fields of Bicylce and Vehice>> from Bicycle,vehicle where
bicycle.id = <<id passed in find>> AND bicycle.id == vehicle.id AND
MountainBike.id IS NULL AND RacingBike.id IS NULL.

"AND MountainBike.id IS NULL AND RacingBike.id IS NULL" is causing the
ObjectNotFound exception beacuse there are no rows in MountainBike and
RacingBike.

The solution for this problem seems to be avoiding the call to
getClassConditions() of SubclassJoinDiscriminatorStrategy.java

Please help.

Regards,
Ravi.
-- 
View this message in context: http://n2.nabble.com/Purpose-of-SubclassJoinDiscriminatorStrategy-getClassConditions-tp4521464p4521464.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.