com.kenshoo.jooq.DataTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of persistence-layer Show documentation
Show all versions of persistence-layer Show documentation
A Java persistence layer based on JOOQ for high performance and business flow support.
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);
}
}