I have two tables with a FK relation. What I want is equivalent to:
select A.*, B.*
from A
join B
on B.A_ID = A.ID
How do I do this efficiently in jOOQ? In the end, I need one instance of ARecord and one of BRecord per resulting row.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Like this
This will fetch
A.*, B.*(or more precisely,A.A1, A.A2, ..., A.AN, B.B1, ...). Now in order to transformresultintoARecordandBRecorduse theResult.into(Table)method:Note, that this has known flaws. For instance, if
A.Xis a field that has a corresponding fieldB.X(same field name),A.Xwill holdB.X‘s value. I have registered a bug report for this: #1802