diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 721552371e..eadc3a1b38 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -383,6 +383,10 @@ public class Settings @XmlElement(defaultValue = "true") protected Boolean returnIdentityOnUpdatableRecord = true; @XmlElement(defaultValue = "false") + protected Boolean returnDefaultOnUpdatableRecord = false; + @XmlElement(defaultValue = "false") + protected Boolean returnComputedOnUpdatableRecord = false; + @XmlElement(defaultValue = "false") protected Boolean returnAllOnUpdatableRecord = false; @XmlElement(defaultValue = "true") protected Boolean returnRecordToPojo = true; @@ -4612,6 +4616,54 @@ public class Settings this.returnIdentityOnUpdatableRecord = value; } + /** + * Whether calls to store(), insert() and update() should return values for columns that are {@link org.jooq.DataType#defaulted()}. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isReturnDefaultOnUpdatableRecord() { + return returnDefaultOnUpdatableRecord; + } + + /** + * Sets the value of the returnDefaultOnUpdatableRecord property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setReturnDefaultOnUpdatableRecord(Boolean value) { + this.returnDefaultOnUpdatableRecord = value; + } + + /** + * Whether calls to store(), insert() and update() should return values for columns that are {@link org.jooq.DataType#computed()}. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isReturnComputedOnUpdatableRecord() { + return returnComputedOnUpdatableRecord; + } + + /** + * Sets the value of the returnComputedOnUpdatableRecord property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setReturnComputedOnUpdatableRecord(Boolean value) { + this.returnComputedOnUpdatableRecord = value; + } + /** * Whether calls to store(), insert() and update() should return all columns, not just identity columns. *
@@ -6840,6 +6892,16 @@ public class Settings
return this;
}
+ public Settings withReturnDefaultOnUpdatableRecord(Boolean value) {
+ setReturnDefaultOnUpdatableRecord(value);
+ return this;
+ }
+
+ public Settings withReturnComputedOnUpdatableRecord(Boolean value) {
+ setReturnComputedOnUpdatableRecord(value);
+ return this;
+ }
+
public Settings withReturnAllOnUpdatableRecord(Boolean value) {
setReturnAllOnUpdatableRecord(value);
return this;
@@ -7473,6 +7535,8 @@ public class Settings
builder.append("fetchWarnings", fetchWarnings);
builder.append("fetchServerOutputSize", fetchServerOutputSize);
builder.append("returnIdentityOnUpdatableRecord", returnIdentityOnUpdatableRecord);
+ builder.append("returnDefaultOnUpdatableRecord", returnDefaultOnUpdatableRecord);
+ builder.append("returnComputedOnUpdatableRecord", returnComputedOnUpdatableRecord);
builder.append("returnAllOnUpdatableRecord", returnAllOnUpdatableRecord);
builder.append("returnRecordToPojo", returnRecordToPojo);
builder.append("mapJPAAnnotations", mapJPAAnnotations);
@@ -8938,6 +9002,24 @@ public class Settings
return false;
}
}
+ if (returnDefaultOnUpdatableRecord == null) {
+ if (other.returnDefaultOnUpdatableRecord!= null) {
+ return false;
+ }
+ } else {
+ if (!returnDefaultOnUpdatableRecord.equals(other.returnDefaultOnUpdatableRecord)) {
+ return false;
+ }
+ }
+ if (returnComputedOnUpdatableRecord == null) {
+ if (other.returnComputedOnUpdatableRecord!= null) {
+ return false;
+ }
+ } else {
+ if (!returnComputedOnUpdatableRecord.equals(other.returnComputedOnUpdatableRecord)) {
+ return false;
+ }
+ }
if (returnAllOnUpdatableRecord == null) {
if (other.returnAllOnUpdatableRecord!= null) {
return false;
@@ -9621,6 +9703,8 @@ public class Settings
result = ((prime*result)+((fetchWarnings == null)? 0 :fetchWarnings.hashCode()));
result = ((prime*result)+((fetchServerOutputSize == null)? 0 :fetchServerOutputSize.hashCode()));
result = ((prime*result)+((returnIdentityOnUpdatableRecord == null)? 0 :returnIdentityOnUpdatableRecord.hashCode()));
+ result = ((prime*result)+((returnDefaultOnUpdatableRecord == null)? 0 :returnDefaultOnUpdatableRecord.hashCode()));
+ result = ((prime*result)+((returnComputedOnUpdatableRecord == null)? 0 :returnComputedOnUpdatableRecord.hashCode()));
result = ((prime*result)+((returnAllOnUpdatableRecord == null)? 0 :returnAllOnUpdatableRecord.hashCode()));
result = ((prime*result)+((returnRecordToPojo == null)? 0 :returnRecordToPojo.hashCode()));
result = ((prime*result)+((mapJPAAnnotations == null)? 0 :mapJPAAnnotations.hashCode()));
diff --git a/jOOQ/src/main/java/org/jooq/conf/SettingsTools.java b/jOOQ/src/main/java/org/jooq/conf/SettingsTools.java
index 3de56c3c0d..362fc001fc 100644
--- a/jOOQ/src/main/java/org/jooq/conf/SettingsTools.java
+++ b/jOOQ/src/main/java/org/jooq/conf/SettingsTools.java
@@ -37,6 +37,8 @@
*/
package org.jooq.conf;
+import static java.lang.Boolean.FALSE;
+import static java.lang.Boolean.TRUE;
import static org.jooq.conf.FetchIntermediateResult.WHEN_EXECUTE_LISTENERS_PRESENT;
import static org.jooq.conf.FetchIntermediateResult.WHEN_RESULT_REQUESTED;
import static org.jooq.conf.ParamType.INDEXED;
@@ -54,6 +56,7 @@ import java.util.ArrayList;
import java.util.Locale;
import org.jooq.Configuration;
+import org.jooq.UpdatableRecord;
import org.jooq.tools.JooqLogger;
import org.jooq.tools.StringUtils;
import org.jooq.util.jaxb.tools.MiniJAXB;
@@ -465,4 +468,15 @@ public final class SettingsTools {
? settings.getFetchServerOutputSize()
: 0;
}
+
+ /**
+ * Whether any value should be returned on an {@link UpdatableRecord}
+ * operation.
+ */
+ public static final boolean returnAnyOnUpdatableRecord(Settings settings) {
+ return !FALSE.equals(settings.isReturnIdentityOnUpdatableRecord())
+ || TRUE.equals(settings.isReturnAllOnUpdatableRecord())
+ || TRUE.equals(settings.isReturnDefaultOnUpdatableRecord())
+ || TRUE.equals(settings.isReturnComputedOnUpdatableRecord());
+ }
}
diff --git a/jOOQ/src/main/java/org/jooq/impl/BatchCRUD.java b/jOOQ/src/main/java/org/jooq/impl/BatchCRUD.java
index 4a83e6cc25..40ec51a3aa 100644
--- a/jOOQ/src/main/java/org/jooq/impl/BatchCRUD.java
+++ b/jOOQ/src/main/java/org/jooq/impl/BatchCRUD.java
@@ -95,8 +95,10 @@ final class BatchCRUD extends AbstractBatch {
// [#1529] Avoid DEBUG logging of single INSERT / UPDATE statements
.withExecuteLogging(false)
- // [#3327] [#11509] We can't return generated keys from batches (yet)
+ // [#3327] [#11509] [#14573] We can't return generated keys from batches (yet)
.withReturnAllOnUpdatableRecord(false)
+ .withReturnDefaultOnUpdatableRecord(false)
+ .withReturnComputedOnUpdatableRecord(false)
.withReturnIdentityOnUpdatableRecord(false);
return local;
diff --git a/jOOQ/src/main/java/org/jooq/impl/DAOImpl.java b/jOOQ/src/main/java/org/jooq/impl/DAOImpl.java
index cd3dde5947..d8a06e26ae 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DAOImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DAOImpl.java
@@ -69,6 +69,7 @@ import org.jooq.TableField;
import org.jooq.UniqueKey;
import org.jooq.UpdatableRecord;
import org.jooq.conf.Settings;
+import org.jooq.conf.SettingsTools;
/**
* A common base implementation for generated {@link DAO}.
@@ -198,8 +199,7 @@ public abstract class DAOImpl