0

My question is somewhat related to this querydsl Tuple Here, Data from a table employee is being fetched. In my use case I have a child table called projects which is having one to many relation with employee table. Eg: employee A can have 3 projects say X, Y, Z. To model this, I have a Employee class with List<Project> as a member variable. Now, I want to select the employee name and all the project that belong to them. What modification I need to make in the query that is shared in the link mentioned above. In terms of SQL I am interested in fetching following.

SELLECT EMP.EMPLOYEE_NAME, PRJ.PROJECT_NAME FROM EMPLOYEE EMP, PROJECT PRJ WHERE EMP.EMP_ID = PRJ.EMP_ID;

Any easy to understand documentation on this topic will also be very helpful.

Atul Kumar Verma
  • 369
  • 3
  • 8
  • 23
  • Possible duplicate of [Querydsl set fetch mode in a query](https://stackoverflow.com/questions/23627482/querydsl-set-fetch-mode-in-a-query) – Selaron Nov 27 '18 at 20:08
  • Please add your code to the question, I'm wondering why are you retrieving Tuples from the query instead of Employees. – vmaldosan Nov 30 '18 at 09:52
  • @vmaldosan, Its more of a _How to properly do this?_ and _Is it possible to do this using querydsl?_ I was interested to know the proper way to do it, even though its not necessary for my app. – Atul Kumar Verma Dec 04 '18 at 16:23

0 Answers0