Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Left Fetch associated subclass attribute in a NamedQuery

Hi everbody,

I am writing my bachelor thesis about evaluating jpa persistence
providers and have a use-case to measure performance of and urgently
need help because it is not working.

I have a class Partner with a one-to-many association to class Address
and also a one-to-many associaton to the abstract class Role. I have two
subtypes of Role which are Applicant and Employee. The used inheritance
strategy is single-table (discriminator column).
An Employee has an one-to-one association to class BankAccount which is
stored in a separate table.

Now I want to eager retrieve all Partners with all Addresses and Roles
and BankAccount in a NamedQuery. I tried the following, because it did
work with Hibernate:

@NamedQuery(name="getAllPartners" value = "SELECT p from Partner p",
hints = {
   @QueryHint(name=QueryHints.LEFT_FETCH p.addresses),
   @QueryHint(name=QueryHints.LEFT_FETCH p.roles),
   @QueryHint(QueryHints.LEFT_FETCH p.roles.bankaccount)}
)

With EclipseLink I got an exception like "navigating non-existant
association p.roles.bankaccount"... or so while trying to deploy the
.ear.

I absolutely do understand why I get the exception, but I have no
idea how to workaround.

Every help/suggestion is more than appreciated.

Mario



Back to the top