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

com.kenshoo.jooq.DataTable 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.jooq;

import org.jooq.ForeignKey;
import org.jooq.Record;
import org.jooq.Table;

import java.util.Collection;
import java.util.List;

public interface DataTable extends Table {

    Collection> getVirtualPartition();

    default ForeignKey getForeignKey(DataTable primaryTable) {
        List> foreignKeys = getReferencesTo(primaryTable);
        if (foreignKeys.size() == 0) {
            throw new IllegalStateException("Table " + getName() + " does not define a foreign key to table " + primaryTable.getName());
        }
        if (foreignKeys.size() > 1) {
            throw new IllegalStateException("Table " + getName() + " defines several foreign keys to table " + primaryTable.getName());
        }

        return foreignKeys.get(0);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy