简体   繁体   中英

How to create RecordN for generated DAO lookup

I am using jOOQ's code generator with DAOs .

I have a table with a composite primary key like this:

CREATE TABLE telefon_client
(
    telefon VARCHAR(15) NOT NULL,
    client VARCHAR(5) NOT NULL,
    data_alta DATE NOT NULL,
    pendent_ajustar TINYINT(1) DEFAULT '1' NOT NULL,
    CONSTRAINT `PRIMARY` PRIMARY KEY (telefon, data_alta)
);

The generated DAO has a method with this interface:

public void deleteById(Record2<String, LocalDate>... ids);

I want to implement this method:

public void delete(String telefon, LocalDate dataAlta) {
    new TelefonClientDao(configuration).deleteById(????);
}

What's the recommended way of building an instance of a Record2 with those two values?

This is one option:

DSL.using(configuration)
   .newRecord(TELEFON_CLIENT.TELEFON, TELEFON_CLIENT.DATA_ALTA)
   .values(telefon, dataAlta);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM