Hi Lukas, is this the same problem while using the following ?
create.select(A.Id).from(A).leftjoin(B).on(B.Id.eq(A.B_Id)) TableARecord tableARecord = record.into(TableA); TableBRecord tableBRecord = record.into(TableB); long idA = tableARecord.get(TableA.Id); long idB = tableBRecord.get(TableB.Id); In this case if only A.Id is selected, both get methods return the same id. I find this very confusing because i would expected the record class to know which id is associated with its table ... Is there a good workaround to this behaviour or a setting to avoid it ? - Best regards Benjamin Am Samstag, 25. Juni 2016 14:37:35 UTC+2 schrieb Lukas Eder: > > Hello Nico, > > You could check for equality after getting the field from the record: > > B.B_ID.equals(record.field(B.B_ID)) > > > That might look a bit fishy at first but it makes sense as it uses the API > contract stating that record.field(Field) returns a Field of the same > Field.getName(), regardless if the resulting Field really equals() the > argument field. > > Hope this helps, > Lukas > > 2016-06-23 11:39 GMT+02:00 McNetic <[email protected] <javascript:>>: > >> Hi, >> >> I have two tables aggregated by a foreign key. Sometimes I just need >> table A, sometimes I want the corresponding record from table B to be >> filled in a member variable. So my SELECTs are like >> create.select().from(A).where(...) >> or >> create.select().from(A).leftJoin(B).on(A.B_ID.eq(B.B_ID)) >> >> Now, I want the RecordMapper to decide wether to fill a member of object >> A with an object B created from the record based on the existance of B.B_ID >> in the record. Is there any way to determine if B.B_ID is present? >> record.field(B.B_ID) >> will always be != null because of A.B_ID also being present in the record. >> record.field("B.B_ID") >> is always null. >> >> Is there any other way to achieve what I want to do? >> >> Thank you very much >> >> Nico >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
