Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
how to query with a join on non primary key column in hibernate

suppose I have the following 3 tables:

Facility id, name

Processor id, facility_id, enabled

Task id, facility_id, processor_id, name

I have queries that naturally join the task table with the processor table, but some tasks may not be linked to processors (i.e. task.processor_id may be null). I want to run a query that pulls all tasks in facilities that are linked to an enabled processor.

In other words, the query should look like this:

select task.name

from task, processor

where task.facility_id = processor.facility_id and processor.enabled = 1

I use @ManyToOne and @JoinColumn annotations to naturally link task to processor and to facility. There is also @ManytoOne and @JoinColumn on processor to facility.

How can I do it using hibernate criteria without resorting to native SQL?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!