I've made an error writing a jooq query using syntax
.innerJoin(TABLE).onKey(Keys.FOREIGN_KEY_NAME) .....
putting the wrong FK keyname. The strange thing is that the outcome was a
null value inside the "on" clause cause field was not on primary key.
IMHO result should be an exception.
In my case code is the following, inside org.jooq.impl.JoinTable
@SuppressWarnings({ "unchecked", "rawtypes" })
private final JoinTable onKey(ForeignKey<?, ?> key, Table<?> fk,
Table<?> pk) {
JoinTable result = this;
TableField<?, ?>[] references = key.getFieldsArray();
TableField<?, ?>[] referenced = key.getKey().getFieldsArray();
for (int i = 0; i < references.length; i++) {
Field f1 = fk.field(references[i]);
Field f2 = pk.field(referenced[i]);
* HERE f2 is null. Why you didn't throw and exception here? Is
it by design?*
// [#2870] TODO: If lhs or rhs are aliased tables, extract the
appropriate fields from them
result.and(f1.equal(f2));
}
return result;
}
Tks
Denis
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.