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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:02:04+00:00 2026-06-09T22:02:04+00:00

Student – Course : OneToMany JPQL : select Student from Student student, Course course

  • 0

Student – Course : OneToMany

JPQL :

select Student from Student student, Course course where
student.name=:STUDENTNAME and (course.courseName=:COURSENAME or
course.courseDuration=courseDuration)

Let us suppose one student might have 10 courses i want to retrieve only two records having Student – Courses(2).

CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Student> criteriaQuery = criteriaBuilder.createQuery(Student.class);
Root<Student> studentRoot = criteriaQuery.from(Student.class);
studentRoot.fetch("courses", JoinType.LEFT);
Predicate condition = criteriaBuilder.equal(studentRoot.get("studentName"), "someName");
//how to add course condition here.
criteriaQuery.where(condition);
  • 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-09T22:02:06+00:00Added an answer on June 9, 2026 at 10:02 pm

    There is no equivalent of JPA QL “JOIN FETCH” in Criteria API.

    JOIN FETCH uses EAGER fetch irrespective of the fetch type specified in the model annotation.

    If you are using criteria api, you can call the getter method of child in the dao,so that it gets loaded.

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

Sidebar

Related Questions

a student select course table. studentnumber name age selected course credit 1 tom 23
I have a table student ( id, name ). Then I have one textbox,
SELECT Student.S_ID, COUNT(*) AS **Final_Exam_Level** FROM Student, Exams, Exam_Allocation WHERE (Student.S_ID)=Exam_Allocation.S_ID And ((Exams.Exam_ID)=Exam_Allocation.Exam_ID) And
SELECT Student.id, Student.first_name, Student.last_name, count(`Attendance`.`id`) as total FROM `karate`.`attendances` AS `Attendance` RIGHT JOIN `karate`.`students`
Student.find(:all, :conditions => [‘name = ? and status = ?’ ‘mohit’, 1]) Vs Student.find_all_by_name_and_status(‘mohit’,
A student of mine submitted some C++ code similar to the following one. The
I am student of RDBMS. I have very basic question let say I have
Student Table SID Name 1 A 2 B 3 C Marks Table id mark
A student in my chemometrics course installed R on Windows 7. Apparently, R picked
SELECT student_id, section, count( * ) as total FROM raw_data r WHERE response =

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.