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 7653311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:00:00+00:00 2026-05-31T12:00:00+00:00

I am using JPQL for the model queries from Play Framework. I wonder if

  • 0

I am using JPQL for the model queries from Play Framework.

I wonder if JPQL supports “complex” ON condition for LEFT JOIN.

In an example I have, there are 2 tables:

  • ‘App’ – list of applications
  • ‘AggregationHistory’ – the list of the aggregation records per application, per date. In the model, it has ‘app’ field representing
    many-to-one with ‘App’ (column name ‘app_id’ in the physical table)

Suppose I want to calculate the list of all the apps that do not have a record for a specific date.

In plain SQL, I get the result using the following query:

SELECT a.* FROM app a LEFT JOIN aggregationhistory ah 
ON a.id = ah.app_id AND ah.fromDate =  '2012-03-14 00:00:00' 
WHERE ah.fromDate is NULL

‘AND’ in ‘ON’ condition is essential, of course.

Now, all the examples of JPQL I see are like:

SELECT a.* FROM AggregationHistory ah  LEFT JOIN ah.app a WHERE ...

So, the only ‘ON’ condition supported – is the “match” of the IDs? (WHERE seems not to help me much)

I can think of workarounds (like, using a “native query”, or using JOIN to get the list of the applications that do have a record, and compare). But I wonder if the query I made in SQL – can be converted into JPQL.

Thanks

  • 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-05-31T12:00:02+00:00Added an answer on May 31, 2026 at 12:00 pm

    JPQL, AFAIK, doesn’t support ON clauses, but HQL does support them. The chose to use the with keyword though:

    select a from App a 
    left join a.history h with h.fromDate = :fromDate
    where h.fromDate is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to perform date arithmetic using JPA/Hibernate? For example, I have an
I'm using JPQL Native query to join table and query result is stored in
I'm using JPQL Native query to join table and query result is stored in
i have four queries that return intergers. select listOfIntegers from [something]... ( edit: the
I am trying to design an entity model using JPA2.0 via hibernate. I have
Using MVC2 I have an AJAX form which is posting to a bound model.
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I have two models: User and Base. User model: http://pastebin.com/WdLzBkHJ Base model: http://pastebin.com/tQrEUaSu At
I've written a simple login system using a JPQL query, which always returns no

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.