[#4724] Compare by PK only if the PK belongs to the same table

This commit is contained in:
lukaseder 2015-11-10 10:32:01 +01:00
parent d3835638e2
commit 7b65c4fd29

View File

@ -515,7 +515,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
UniqueKey<R> thisPK = this.getPrimaryKey();
UniqueKey<R> thatPK = that.getPrimaryKey();
if (thisPK != null && thatPK != null) {
if (thisPK != null && thatPK != null && thisPK.getTable().equals(thatPK.getTable())) {
return row(fields(thisPK.getFieldsArray())).eq(row(that.fields(thatPK.getFieldsArray())));
}
else {
@ -533,7 +533,7 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
UniqueKey<R> thisPK = this.getPrimaryKey();
UniqueKey<R> thatPK = that.getPrimaryKey();
if (thisPK != null && thatPK != null) {
if (thisPK != null && thatPK != null && thisPK.getTable().equals(thatPK.getTable())) {
return row(fields(thisPK.getFieldsArray())).ne(row(that.fields(thatPK.getFieldsArray())));
}
else {