Multiple reverse collections.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Multiple reverse collections.

Stephane Passignat

I have a case I can't fix in openjpa.

When a class (Product) have 2 collections (I only checked with reversed mapping) of concrete objects (one of MecanicalFeature and one of ElectricalFeature) inheriting from a common class (Feature), finding an existing Product fails (return null).

Here is a class diagram :

Here is the ER diagram

The entityManager.find generates the following SQL (I replaced useless columns by *) :

SELECT t0.*,


FROM Product t0

       LEFT OUTER JOIN Feature t3 ON = t3.PRODUCT_ID

WHERE (t3.disc IS NULL OR t3.disc IN ('Mecanical'))

  AND = 0


The eager fetching on those collections consider only one collection or only one type of concrete class. A solution would be to have, in the IN clause the list of all possible subtypes of all collections mapped on the target table (‘Mecanical’, ‘Electrical’).



Envoyé par BlueMail<>