openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravi P Palacherla <ravi.palache...@oracle.com>
Subject Purpose of SubclassJoinDiscriminatorStrategy.getClassConditions()
Date Fri, 05 Feb 2010 18:44:47 GMT

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.

Mime
View raw message