#1457 - Issue with @ManyToOne with @EmbeddedId where only some columns are insertable or updatable

This commit is contained in:
rob bygrave committed 2018-07-18 21:29:08 +12:00
1 parent 2d44d06f36
commit 01541bb208
14 files changed
+318 -22

No files matched your search

@@ -19,6 +19,11 @@ public class DeleteHandler extends DmlHandler {
this.meta = meta;
}
@Override
public boolean isUpdate() {
return false;
}
/**
* Generate and bind the delete statement.
*/
@@ -29,10 +29,6 @@ public class GenerateDmlRequest {
return this;
}
public void appendColumnIsNull(String column) {
appendColumn(column, IS_NULL);
}
public void appendColumn(String column) {
//String bind = (insertMode > 0) ? "?" : "=?";
appendColumn(column, "?");
@@ -91,4 +87,7 @@ public class GenerateDmlRequest {
this.prefix2 = ", ";
}
public boolean isUpdate() {
return insertMode == 0;
}
}
@@ -50,6 +50,11 @@ public class InsertHandler extends DmlHandler {
this.concatinatedKey = meta.isConcatenatedKey();
}
@Override
public boolean isUpdate() {
return false;
}
/**
* Generate and bind the insert statement.
*/
@@ -22,6 +22,11 @@ public class UpdateHandler extends DmlHandler {
this.meta = meta;
}
@Override
public boolean isUpdate() {
return true;
}
/**
* Generate and bind the update statement.
*/
@@ -59,4 +59,8 @@ public interface BindableRequest {
*/
long now();
/**
* Return true if this is an update request.
*/
boolean isUpdate();
}
@@ -19,9 +19,7 @@ public class FactoryAssocOnes {
*/
public void create(List<Bindable> list, BeanDescriptor<?> desc, DmlMode mode) {
BeanPropertyAssocOne<?>[] ones = desc.propertiesOneImported();
for (BeanPropertyAssocOne<?> one : ones) {
for (BeanPropertyAssocOne<?> one : desc.propertiesOneImported()) {
if (!one.isImportedPrimaryKey()) {
switch (mode) {
case INSERT: