All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kenshoo.pl.data.DeleteRecordCommand Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.data;

import com.kenshoo.jooq.DataTable;
import org.jooq.Field;
import org.jooq.Record;
import org.jooq.TableField;

public class DeleteRecordCommand extends AbstractRecordCommand {

    private final DatabaseId id;

    public DeleteRecordCommand(DataTable table, DatabaseId id) {
        super(table);
        this.id = id;
    }

    /**
     * Convenience constructor for tables with integer ID
     */
    public DeleteRecordCommand(DataTable table, int id) {
        super(table);
        TableField primaryKeyField = getPrimaryKeyField(table, Integer.class);
        //noinspection unchecked
        this.id = DatabaseId.create((TableField) primaryKeyField, id);
    }

    /**
     * Convenience constructor for tables with bigint ID
     */
    public DeleteRecordCommand(DataTable table, long id) {
        super(table);
        TableField primaryKeyField = getPrimaryKeyField(table, Long.class);
        //noinspection unchecked
        this.id = DatabaseId.create((TableField) primaryKeyField, id);
    }

    public DatabaseId getId() {
        return id;
    }

    @Override
    public  void set(Field field, T value) {
        throw new UnsupportedOperationException("Setting a field is not supported for a delete command");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy