Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How optimal get one Entry (Record) by id with JOOQ?

I think that is very simple, but I cannot find anything simple in the docs.

How optimal get one Entry (Record) by id with JOOQ?

Something like for creation of Record:

factory.newRecord(MY_TABLE);

also

MyTableRecord record = factory.selectRecord(MY_TABLE.ID.like(id));
like image 560
Mark Avatar asked Mar 01 '13 10:03

Mark


1 Answers

Apart from what yellow suggested in his answer, you can also use this "short form" here:

MyTableRecord record = factory.fetchOne(MY_TABLE, MY_TABLE.ID.like(id));

With jOOQ 2.x's Factory.fetchOne(Table, Condition) or jOOQ 3.x's DSLContext.fetchOne(Table, Condition) method.

like image 89
Lukas Eder Avatar answered Nov 10 '22 00:11

Lukas Eder