org.jooq.ForeignKey Java Examples

The following examples show how to use org.jooq.ForeignKey. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReflectedTable.java    From java-crud-api with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
public ReflectedTable(Table<?> table) {
	super(table.getQualifiedName());
	this.table = table;
	for (Field<?> field : table.fields()) {
		String name = field.getName();
		DataType<Object> dataType = (DataType<Object>) field.getDataType();
		TableField newField = createField(name, dataType);
		fields.put(name, newField);
	}
	UniqueKey<?> primaryKey = table.getPrimaryKey();
	if (primaryKey != null) {
		if (primaryKey.getFields().size() == 1) {
			pk = primaryKey.getFields().get(0);
		}
	}
	for (ForeignKey<?, ?> fk : table.getReferences()) {
		fks.put(findForeignKeyFieldName(fk), findForeignKeyReference(fk));
	}
}
 
Example #2
Source File: ReflectedTable.java    From java-crud-api with MIT License 5 votes vote down vote up
private String findForeignKeyFieldName(ForeignKey<?, ?> fk) {
	TableField<?, ?>[] pks = fk.getFieldsArray();
	if (pks.length == 1) {
		return pks[0].getName();
	}
	return null;
}
 
Example #3
Source File: ReflectedTable.java    From java-crud-api with MIT License 5 votes vote down vote up
private String findForeignKeyReference(ForeignKey<?, ?> fk) {
	UniqueKey<?> pk = fk.getKey();
	if (pk != null) {
		Field<?>[] pks = pk.getFieldsArray();
		if (pks.length == 1) {
			return pk.getTable().getName();
		}
	}
	return null;
}
 
Example #4
Source File: Labels.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
public <O extends Record> Labels(Table<O> child, ForeignKey<O, LabelsRecord> key) {
    super(child, key, LABELS);
    this.ID = createField("id", SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field("nextval('tags_id_seq'::regclass)", SQLDataType.INTEGER)), this, "");
    this.UUID = createField("uuid", SQLDataType.UUID.nullable(false), this, "");
    this.NAME = createField("name", SQLDataType.VARCHAR(500).nullable(false), this, "");
    this.OBSOLETE = createField("obsolete", SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field("false", SQLDataType.BOOLEAN)), this, "");
}
 
Example #5
Source File: Somethingwithoutjson.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingwithoutjson(Table<O> child, ForeignKey<O, SomethingwithoutjsonRecord> key) {
    super(child, key, SOMETHINGWITHOUTJSON);
}
 
Example #6
Source File: Something.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Something(Table<O> child, ForeignKey<O, SomethingRecord> key) {
    super(child, key, SOMETHING);
}
 
Example #7
Source File: Somethingcomposite.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingcomposite(Table<O> child, ForeignKey<O, SomethingcompositeRecord> key) {
    super(child, key, SOMETHINGCOMPOSITE);
}
 
Example #8
Source File: Something.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Something(Table<O> child, ForeignKey<O, SomethingRecord> key) {
    super(child, key, SOMETHING);
}
 
Example #9
Source File: Something.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Something(Table<O> child, ForeignKey<O, SomethingRecord> key) {
    super(child, key, SOMETHING);
}
 
Example #10
Source File: Something.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Something(Table<O> child, ForeignKey<O, SomethingRecord> key) {
    super(child, key, SOMETHING);
}
 
Example #11
Source File: Somethingcomposite.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingcomposite(Table<O> child, ForeignKey<O, SomethingcompositeRecord> key) {
    super(child, key, SOMETHINGCOMPOSITE);
}
 
Example #12
Source File: Something.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Something(Table<O> child, ForeignKey<O, SomethingRecord> key) {
    super(child, key, SOMETHING);
}
 
Example #13
Source File: PostTagLinksTable.java    From StubbornJava with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<ForeignKey<PostTagLinksRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<PostTagLinksRecord, ?>>asList(Keys.POST_TAG_LINKS_POST_ID_FK, Keys.POST_TAG_LINKS_POST_TAG_ID_FK);
}
 
Example #14
Source File: Somethingwithoutjson.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingwithoutjson(Table<O> child, ForeignKey<O, SomethingwithoutjsonRecord> key) {
    super(child, key, SOMETHINGWITHOUTJSON);
}
 
Example #15
Source File: Somethingcomposite.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingcomposite(Table<O> child, ForeignKey<O, SomethingcompositeRecord> key) {
    super(child, key, SOMETHINGCOMPOSITE);
}
 
Example #16
Source File: Something.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Something(Table<O> child, ForeignKey<O, SomethingRecord> key) {
    super(child, key, SOMETHING);
}
 
Example #17
Source File: Somethingwithoutjson.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingwithoutjson(Table<O> child, ForeignKey<O, SomethingwithoutjsonRecord> key) {
    super(child, key, SOMETHINGWITHOUTJSON);
}
 
Example #18
Source File: Somethingcomposite.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingcomposite(Table<O> child, ForeignKey<O, SomethingcompositeRecord> key) {
    super(child, key, SOMETHINGCOMPOSITE);
}
 
Example #19
Source File: Author.java    From SimpleFlatMapper with MIT License 4 votes vote down vote up
public <O extends Record> Author(Table<O> child, ForeignKey<O, AuthorRecord> key) {
    super(child, key, AUTHOR);
}
 
Example #20
Source File: Somethingwithoutjson.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingwithoutjson(Table<O> child, ForeignKey<O, SomethingwithoutjsonRecord> key) {
    super(child, key, SOMETHINGWITHOUTJSON);
}
 
Example #21
Source File: Projectemployee.java    From java-persistence-frameworks-comparison with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<ForeignKey<ProjectemployeeRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<ProjectemployeeRecord, ?>>asList(Keys.PROJECTEMPLOYEE__PROJECTEMPLOYEE_PROJECT_PID_FKEY, Keys.PROJECTEMPLOYEE__PROJECTEMPLOYEE_EMPLOYEE_PID_FKEY);
}
 
Example #22
Source File: PostTagTable.java    From StubbornJava with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<ForeignKey<PostTagRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<PostTagRecord, ?>>asList(Keys.POST_TAG_APP_ID_FK);
}
 
Example #23
Source File: Somethingwithoutjson.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingwithoutjson(Table<O> child, ForeignKey<O, SomethingwithoutjsonRecord> key) {
    super(child, key, SOMETHINGWITHOUTJSON);
}
 
Example #24
Source File: PostTagLinksTable.java    From StubbornJava with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<ForeignKey<PostTagLinksRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<PostTagLinksRecord, ?>>asList(Keys.POST_TAG_LINKS_POST_ID_FK, Keys.POST_TAG_LINKS_POST_TAG_ID_FK);
}
 
Example #25
Source File: FlywaySchemaHistory.java    From curiostack with MIT License 4 votes vote down vote up
public <O extends Record> FlywaySchemaHistory(Table<O> child, ForeignKey<O, FlywaySchemaHistoryRecord> key) {
    super(child, key, FLYWAY_SCHEMA_HISTORY);
}
 
Example #26
Source File: Somethingwithoutjson.java    From vertx-jooq with MIT License 4 votes vote down vote up
public <O extends Record> Somethingwithoutjson(Table<O> child, ForeignKey<O, SomethingwithoutjsonRecord> key) {
    super(child, key, SOMETHINGWITHOUTJSON);
}
 
Example #27
Source File: Place.java    From curiostack with MIT License 4 votes vote down vote up
public <O extends Record> Place(Table<O> child, ForeignKey<O, PlaceRecord> key) {
    super(child, key, PLACE);
}
 
Example #28
Source File: Book.java    From SimpleFlatMapper with MIT License 4 votes vote down vote up
@Override
public List<ForeignKey<BookRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<BookRecord, ?>>asList(Keys.FK_T_BOOK_AUTHOR_ID);
}
 
Example #29
Source File: DjDpmtApprovals.java    From oneops with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<ForeignKey<DjDpmtApprovalsRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<DjDpmtApprovalsRecord, ?>>asList(Keys.DJ_DPMT_APPROVALS__DJ_DPMT_APPROVALS_DPMT_ID_FK, Keys.DJ_DPMT_APPROVALS__DJ_DPMT_APPROVALS_STATES_FK);
}
 
Example #30
Source File: NsOpt.java    From oneops with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<ForeignKey<NsOptRecord, ?>> getReferences() {
    return Arrays.<ForeignKey<NsOptRecord, ?>>asList(Keys.NS_OPT__NS_PATH_NS_OPT_FK);
}