persistence@glassfish.java.net

RE: EJBQL FETCH JOIN query with many-to-many relationship

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Wed, 16 Nov 2005 10:03:39 -0500

Hello Michael,
        This error is because TopLink does not yet support joining Many to Many relationships. We have completed join support for other mapping types and will be completing joining for Many to Many shortly.
--Gordon

-----Original Message-----
From: Michael Bouschen [mailto:Michael.Bouschen_at_Sun.COM]
Sent: Tuesday, November 15, 2005 12:53 PM
To: Tom Ware
Cc: persistence_at_glassfish.dev.java.net
Subject: EJBQL FETCH JOIN query with many-to-many relationship


Hi Tom,

Shelly pointed me to a problem with an EJBQL query having a FETCH JOIN
clause for a many-to-many relationship field. Classes Customer and Alias
  have a many-to-many relationship: Customer.aliases<->Alias.customers.
The query
   SELECT c FROM Customer c JOIN FETCH c.aliases
fails with the exception:
   The join expression
     Query Key aliases
       Base oracle.toplink.examples.Customer is not valid, or for a
mapping type that does not support joining.

Using the relationship from the other side gives the same exception
complaining about Query Key customers:
   SELECT a FROM Alias a JOIN FETCH a.customers

I can successfully execute a query fetching the collection relationship
field from a one-to-many relationship:
   SELECT c FROM Customer c JOIN FETCH c.orders

Do you have an idea?

Regards Michael