Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8276529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:24:16+00:00 2026-06-08T08:24:16+00:00

How do I get JPA & JPQL to pass a complete join query to

  • 0

How do I get JPA & JPQL to pass a complete join query to the RDBMS? For example,

SELECT e
FROM Employee e
WHERE a.runkey = e.runkey
  AND e.middle = 'M'
  AND a.state = 'MA'

With the following Employee class

@Entity
public class Employee implements Serializable {

  blah ... blah

  @OneToOne
  @JoinColumn(
    name = "runkey",
    referencedColumnName = "runkey",
    insertable=false, updatable=false)
  private Address address;
}

and the JPQL,

SELECT e
FROM Employee e
INNER JOIN FETCH e.address AS a
WHERE a.state = :state
 AND e.middle = :middle

I am able to get Hibernate JPA to pull the data as expected.

However, eclipselink croaks that it cannot traverse associated field “address”.

If so, how then should I design the Employee entity and how should I phrase the JPQL in order to get eclipselink to execute a table join with WHERE filters on both tables?

(Rant: Otherwise Eclipselink JPA is no better than JDO!!!)

~

Further edit: Does this post mean anything to my case ….
https://forums.oracle.com/forums/thread.jspa?threadID=1568659

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:24:17+00:00Added an answer on June 8, 2026 at 8:24 am

    The problem is that you are trying to alias a join fetch which is not allowed according to the JPQL specs. Hibernate allows this anyway.
    You can still obtain the desired behavior with EclipseLink using query hints.

    Take a look at the following posts:

    • jpa fetch join query
    • EclipseLink JPQL (Glassfish v3): join fetch syntax problem?

    The following link can also be useful:

    http://wiki.eclipse.org/EclipseLink/Examples/JPA/QueryOptimization

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I pass an empty list into a JPA query, I get an error.
I have a JPA object called Customer.java: @NamedQueries({@NamedQuery(name=getAccountWithCheckRangeByService, query=SELECT c FROM Customer}) public Long
May I know how can I get the sql from a JPA query? or
So if my JPA query is like this: Select distinct p from Parent p
I am using this JPA-Query (EclipseLink): SELECT e FROM Entity e GROUP BY e.label
How to get value of some fields in a native query (JPA)? For example
Can anyone help me to get the JPA criteria query for the JPA query
I want to use JPA (eclipselink) to get data from my database. The database
I have a Spring/JPA/Hibernate application and am trying to get it to pass my
I want to get data from the database (MySQL) by JPA, I want it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.