diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index f40b998c49..fad547693f 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -95,6 +95,8 @@ public class Settings protected Boolean renderOutputForSQLServerReturningClause = true; @XmlElement(defaultValue = "false") protected Boolean renderParenthesisAroundSetOperationQueries = false; + @XmlElement(defaultValue = ".") + protected String namePathSeparator = "."; @XmlElement(defaultValue = "false") protected Boolean bindOffsetDateTimeType = false; @XmlElement(defaultValue = "false") @@ -867,6 +869,44 @@ public class Settings this.renderParenthesisAroundSetOperationQueries = value; } + /** + * The character(s) to be used as a separator in paths encoded in a {@link Name} + *
+ * A few hierarchical mapping features work with paths encoded in names (specifically field aliases), such as the reflective mapping of nested values when aliasing fields as: + *
+ *
+ *
+ * SELECT
+ * a.first_name AS "book.author.firstName"
+ * a.last_name AS "book.author.lastName"
+ * FROM ...
+ *
+ * Not all dialects support "." in identifiers. This setting allows for specifying an alternative String to use as separator, e.g. "__". + * + */ + public String getNamePathSeparator() { + return namePathSeparator; + } + + /** + * The character(s) to be used as a separator in paths encoded in a {@link Name} + *
+ * A few hierarchical mapping features work with paths encoded in names (specifically field aliases), such as the reflective mapping of nested values when aliasing fields as: + *
+ *
+ *
+ * SELECT
+ * a.first_name AS "book.author.firstName"
+ * a.last_name AS "book.author.lastName"
+ * FROM ...
+ *
+ * Not all dialects support "." in identifiers. This setting allows for specifying an alternative String to use as separator, e.g. "__".
+ *
+ */
+ public void setNamePathSeparator(String value) {
+ this.namePathSeparator = value;
+ }
+
/**
* Whether the java.time (JSR 310) type {@link java.time.OffsetDateTime} should be bound natively to JDBC.
*
@@ -2987,6 +3027,26 @@ public class Settings return this; } + /** + * The character(s) to be used as a separator in paths encoded in a {@link Name} + *
+ * A few hierarchical mapping features work with paths encoded in names (specifically field aliases), such as the reflective mapping of nested values when aliasing fields as: + *
+ *
+ *
+ * SELECT
+ * a.first_name AS "book.author.firstName"
+ * a.last_name AS "book.author.lastName"
+ * FROM ...
+ *
+ * Not all dialects support "." in identifiers. This setting allows for specifying an alternative String to use as separator, e.g. "__".
+ *
+ */
+ public Settings withNamePathSeparator(String value) {
+ setNamePathSeparator(value);
+ return this;
+ }
+
public Settings withBindOffsetDateTimeType(Boolean value) {
setBindOffsetDateTimeType(value);
return this;
@@ -3752,6 +3812,7 @@ public class Settings
builder.append("renderOrderByRownumberForEmulatedPagination", renderOrderByRownumberForEmulatedPagination);
builder.append("renderOutputForSQLServerReturningClause", renderOutputForSQLServerReturningClause);
builder.append("renderParenthesisAroundSetOperationQueries", renderParenthesisAroundSetOperationQueries);
+ builder.append("namePathSeparator", namePathSeparator);
builder.append("bindOffsetDateTimeType", bindOffsetDateTimeType);
builder.append("bindOffsetTimeType", bindOffsetTimeType);
builder.append("fetchTriggerValuesAfterSQLServerOutput", fetchTriggerValuesAfterSQLServerOutput);
@@ -4080,6 +4141,15 @@ public class Settings
return false;
}
}
+ if (namePathSeparator == null) {
+ if (other.namePathSeparator!= null) {
+ return false;
+ }
+ } else {
+ if (!namePathSeparator.equals(other.namePathSeparator)) {
+ return false;
+ }
+ }
if (bindOffsetDateTimeType == null) {
if (other.bindOffsetDateTimeType!= null) {
return false;
@@ -4930,6 +5000,7 @@ public class Settings
result = ((prime*result)+((renderOrderByRownumberForEmulatedPagination == null)? 0 :renderOrderByRownumberForEmulatedPagination.hashCode()));
result = ((prime*result)+((renderOutputForSQLServerReturningClause == null)? 0 :renderOutputForSQLServerReturningClause.hashCode()));
result = ((prime*result)+((renderParenthesisAroundSetOperationQueries == null)? 0 :renderParenthesisAroundSetOperationQueries.hashCode()));
+ result = ((prime*result)+((namePathSeparator == null)? 0 :namePathSeparator.hashCode()));
result = ((prime*result)+((bindOffsetDateTimeType == null)? 0 :bindOffsetDateTimeType.hashCode()));
result = ((prime*result)+((bindOffsetTimeType == null)? 0 :bindOffsetTimeType.hashCode()));
result = ((prime*result)+((fetchTriggerValuesAfterSQLServerOutput == null)? 0 :fetchTriggerValuesAfterSQLServerOutput.hashCode()));
diff --git a/jOOQ/src/main/java/org/jooq/impl/ConstantSortField.java b/jOOQ/src/main/java/org/jooq/impl/ConstantSortField.java
index 684df3bdf4..169de689f7 100644
--- a/jOOQ/src/main/java/org/jooq/impl/ConstantSortField.java
+++ b/jOOQ/src/main/java/org/jooq/impl/ConstantSortField.java
@@ -69,6 +69,7 @@ final class ConstantSortField
+
+Not all dialects support "." in identifiers. This setting allows for specifying an alternative String to use as separator, e.g. "__".]]>
true the queries combined with set oper
For details, see https://github.com/jOOQ/jOOQ/issues/3676 and https://github.com/jOOQ/jOOQ/issues/9751.]]>
+
+
+SELECT
+ a.first_name AS "book.author.firstName"
+ a.last_name AS "book.author.lastName"
+FROM ...
+