[#5384] Add Settings.executeWithOptimisticLockingExcludeUnversioned
This commit is contained in:
parent
f07e8fa4f0
commit
22c0f9f411
@ -54,7 +54,7 @@
|
||||
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
|
||||
<bindingDirectory>src/main/resources/xjb</bindingDirectory>
|
||||
<schemaIncludes>
|
||||
<include>jooq-runtime-3.8.0.xsd</include>
|
||||
<include>jooq-runtime-3.9.0.xsd</include>
|
||||
</schemaIncludes>
|
||||
<generatePackage>org.jooq.conf</generatePackage>
|
||||
<args>
|
||||
|
||||
@ -242,7 +242,8 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
|
||||
|
||||
// [#1547] Try fetching the Record again first, and compare this
|
||||
// Record's original values with the ones in the database
|
||||
else {
|
||||
// [#5384] Do this only if the exclusion flag for unversioned records is off
|
||||
else if (isExecuteWithOptimisticLockingIncludeUnversioned()) {
|
||||
checkIfChanged(keys);
|
||||
}
|
||||
}
|
||||
@ -297,7 +298,8 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
|
||||
|
||||
// [#1547] Try fetching the Record again first, and compare this
|
||||
// Record's original values with the ones in the database
|
||||
else {
|
||||
// [#5384] Do this only if the exclusion flag for unversioned records is off
|
||||
else if (isExecuteWithOptimisticLockingIncludeUnversioned()) {
|
||||
checkIfChanged(keys);
|
||||
}
|
||||
}
|
||||
@ -385,11 +387,18 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
|
||||
Configuration configuration = configuration();
|
||||
|
||||
// This can be null when the current record is detached
|
||||
if (configuration != null) {
|
||||
return TRUE.equals(configuration.settings().isExecuteWithOptimisticLocking());
|
||||
}
|
||||
return configuration != null
|
||||
? TRUE.equals(configuration.settings().isExecuteWithOptimisticLocking())
|
||||
: false;
|
||||
}
|
||||
|
||||
return false;
|
||||
private final boolean isExecuteWithOptimisticLockingIncludeUnversioned() {
|
||||
Configuration configuration = configuration();
|
||||
|
||||
// This can be null when the current record is detached
|
||||
return configuration != null
|
||||
? !TRUE.equals(configuration.settings().isExecuteWithOptimisticLockingExcludeUnversioned())
|
||||
: true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@ -12,16 +12,16 @@
|
||||
<jaxb:globalBindings>
|
||||
|
||||
<!-- Force all classes implements Serializable -->
|
||||
<xjc:serializable uid="380" />
|
||||
<xjc:serializable uid="390" />
|
||||
</jaxb:globalBindings>
|
||||
|
||||
<!-- [#2928] Regular expressions -->
|
||||
<jaxb:bindings schemaLocation="../xsd/jooq-runtime-3.8.0.xsd" multiple="true" node="//xs:element[@name='inputExpression']">
|
||||
<jaxb:bindings schemaLocation="../xsd/jooq-runtime-3.9.0.xsd" multiple="true" node="//xs:element[@name='inputExpression']">
|
||||
<xjc:javaType name="java.util.regex.Pattern" adapter="org.jooq.conf.RegexAdapter"/>
|
||||
</jaxb:bindings>
|
||||
|
||||
<!-- Annotate the following classes with @SuppressWarnings -->
|
||||
<jaxb:bindings schemaLocation="../xsd/jooq-runtime-3.8.0.xsd" multiple="true" node="//xs:complexType">
|
||||
<jaxb:bindings schemaLocation="../xsd/jooq-runtime-3.9.0.xsd" multiple="true" node="//xs:complexType">
|
||||
<inheritance:extends>org.jooq.conf.SettingsBase</inheritance:extends>
|
||||
<inheritance:implements>java.lang.Cloneable</inheritance:implements>
|
||||
<annox:annotate>
|
||||
|
||||
278
jOOQ/src/main/resources/xsd/jooq-runtime-3.9.0.xsd
Normal file
278
jOOQ/src/main/resources/xsd/jooq-runtime-3.9.0.xsd
Normal file
@ -0,0 +1,278 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema
|
||||
xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:jooq-runtime="http://www.jooq.org/xsd/jooq-runtime-3.8.0.xsd"
|
||||
targetNamespace="http://www.jooq.org/xsd/jooq-runtime-3.8.0.xsd"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<element name="settings" type="jooq-runtime:Settings"/>
|
||||
|
||||
<complexType name="Settings">
|
||||
<all>
|
||||
<!-- Whether any catalog name should be rendered at all.
|
||||
Use this for single-catalog environments, or when all objects are made
|
||||
available using synonyms -->
|
||||
<element name="renderCatalog" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- Whether any schema name should be rendered at all.
|
||||
|
||||
Setting this to false also implicitly sets "renderCatalog" to false.
|
||||
|
||||
Use this for single-schema environments, or when all objects are made
|
||||
available using synonyms -->
|
||||
<element name="renderSchema" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- Configure render mapping for runtime schema / table rewriting in
|
||||
generated SQL -->
|
||||
<element name="renderMapping" type="jooq-runtime:RenderMapping" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- Whether rendered schema, table, column names, etc should be quoted
|
||||
in rendered SQL, or transformed in any other way.
|
||||
This is set to "QUOTED" by default for backwards-compatibility -->
|
||||
<element name="renderNameStyle" type="jooq-runtime:RenderNameStyle" minOccurs="0" maxOccurs="1" default="QUOTED"/>
|
||||
|
||||
<!-- Whether SQL keywords should be rendered with upper or lower case -->
|
||||
<element name="renderKeywordStyle" type="jooq-runtime:RenderKeywordStyle" minOccurs="0" maxOccurs="1" default="AS_IS"/>
|
||||
|
||||
<!-- Whether rendered SQL should be pretty-printed -->
|
||||
<element name="renderFormatted" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
|
||||
|
||||
<!-- Whether stored function calls should be wrapped in scalar subqueries.
|
||||
Oracle 11g (and potentially, other databases too) implements scalar subquery caching. With this flag
|
||||
set to true, users can automatically profit from this feature in all SQL statements. -->
|
||||
<element name="renderScalarSubqueriesForStoredFunctions" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
|
||||
|
||||
<!-- Whether string literals should be escaped with backslash. -->
|
||||
<element name="backslashEscaping" type="jooq-runtime:BackslashEscaping" minOccurs="0" maxOccurs="1" default="DEFAULT"/>
|
||||
|
||||
<!-- Whether rendered bind values should be rendered as:
|
||||
|
||||
- question marks
|
||||
- named parameters
|
||||
- named or inlined parameters
|
||||
- inlined parameters
|
||||
|
||||
This value is overridden by statementType == STATIC_STATEMENT, in
|
||||
case of which, this defaults to INLINED
|
||||
-->
|
||||
<element name="paramType" type="jooq-runtime:ParamType" minOccurs="0" maxOccurs="1" default="INDEXED"/>
|
||||
|
||||
<!-- The type of statement that is to be executed -->
|
||||
<element name="statementType" type="jooq-runtime:StatementType" minOccurs="0" maxOccurs="1" default="PREPARED_STATEMENT"/>
|
||||
|
||||
<!-- When set to true, this will add jOOQ's default logging ExecuteListeners -->
|
||||
<element name="executeLogging" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- Whether store() and delete() methods should be executed with optimistic locking -->
|
||||
<element name="executeWithOptimisticLocking" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
|
||||
|
||||
<!-- Whether store() and delete() methods should be executed with optimistic locking also on "unversioned" tables,
|
||||
i.e. on tables that do not have a version and/or timestamp column.
|
||||
|
||||
This flag has no effect when "executeWithOptimisticLocking" is turned off -->
|
||||
<element name="executeWithOptimisticLockingExcludeUnversioned" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
|
||||
|
||||
<!-- Whether fetched records should be attached to the fetching configuration -->
|
||||
<element name="attachRecords" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- Whether primary key values are deemed to be "updatable" in jOOQ
|
||||
|
||||
Setting this to "true" will allow for updating primary key values through
|
||||
UpdatableRecord.store() and UpdatableRecord.update()
|
||||
-->
|
||||
<element name="updatablePrimaryKeys" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
|
||||
|
||||
<!-- Whether reflection information should be cached in the configuration -->
|
||||
<element name="reflectionCaching" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- Whether warnings should be fetched after each query execution -->
|
||||
<element name="fetchWarnings" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- Whether calls to store(), insert() and update() should return all columns, not just identity columns.
|
||||
Do note that only few databases support this feature. It is supported only in case the INSERT's or UPDATE's
|
||||
RETURNING clause is fully supported, also for non-IDENTITY columns -->
|
||||
<element name="returnAllOnUpdatableRecord" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
|
||||
|
||||
<!-- Whether JPA annotations should be considered by the DefaultRecordMapper.
|
||||
|
||||
This flag defaults to true in jOOQ 3.7 (emitting a warning when being used)
|
||||
It will default to false in jOOQ 3.8
|
||||
And the feature will be removed entirely in jOOQ 4.0 -->
|
||||
<element name="mapJPAAnnotations" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
|
||||
|
||||
<!-- The default JDBC queryTimeout property that should be applied to all
|
||||
jOOQ queries, for which no specific queryTimeout was specified -->
|
||||
<element name="queryTimeout" type="int" minOccurs="0" maxOccurs="1" default="0"/>
|
||||
|
||||
<!-- The default JDBC maxRows property that should be applied to all
|
||||
jOOQ queries, for which no specific maxRows value was specified -->
|
||||
<element name="maxRows" type="int" minOccurs="0" maxOccurs="1" default="0"/>
|
||||
|
||||
<!-- The default JDBC fetchSize property that should be applied to all
|
||||
jOOQ queries, for which no specific fetchSize value was specified -->
|
||||
<element name="fetchSize" type="int" minOccurs="0" maxOccurs="1" default="0"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="RenderMapping">
|
||||
<all>
|
||||
<!-- The default schema as defined in org.jooq.Schema.getName()
|
||||
This schema will be omitted in rendered SQL -->
|
||||
<element name="defaultSchema" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- The mapped schemata configuration -->
|
||||
<element name="schemata" type="jooq-runtime:MappedSchemata" minOccurs="0" maxOccurs="1"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="MappedSchemata">
|
||||
<sequence>
|
||||
<element name="schema" type="jooq-runtime:MappedSchema" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="MappedSchema">
|
||||
<all>
|
||||
<!-- The input schema name as defined in org.jooq.Schema.getName()
|
||||
Either <input/> or <inputExpression/> must be provided -->
|
||||
<element name="input" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- A regular expression matching the input schema name as defined in org.jooq.Schema.getName()
|
||||
Either <input/> or <inputExpression/> must be provided -->
|
||||
<element name="inputExpression" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- The output schema as it will be rendered in SQL.
|
||||
* When this is omitted, you can still apply table mapping.
|
||||
* When <input/> is provided, <output/> is a constant value
|
||||
* When <inputExpression/> is provided, <output/> is a replacement expression -->
|
||||
<element name="output" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- Configure table mapping for runtime table rewriting in
|
||||
generated SQL -->
|
||||
<element name="tables" type="jooq-runtime:MappedTables" minOccurs="0" maxOccurs="1"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="MappedTables">
|
||||
<sequence>
|
||||
<element name="table" type="jooq-runtime:MappedTable" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="MappedTable">
|
||||
<all>
|
||||
|
||||
<!-- The input table as defined in org.jooq.Table.getName()
|
||||
Either <input/> or <inputExpression/> must be provided -->
|
||||
<element name="input" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- A regular expression matching the input table name as defined in org.jooq.Table.getName()
|
||||
Either <input/> or <inputExpression/> must be provided -->
|
||||
<element name="inputExpression" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<!-- The output table as it will be rendered in SQL
|
||||
* When <input/> is provided, <output/> is a constant value
|
||||
* When <inputExpression/> is provided, <output/> is a replacement expression -->
|
||||
<element name="output" type="string" minOccurs="1" maxOccurs="1"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="ParamType">
|
||||
<restriction base="string">
|
||||
|
||||
<!-- Execute statements with indexed parameters, the way JDBC expects them -->
|
||||
<enumeration value="INDEXED"/>
|
||||
|
||||
<!-- Execute statements with named parameters -->
|
||||
<enumeration value="NAMED"/>
|
||||
|
||||
<!-- Execute statements with named parameters, if a name is given, or inlined parameters otherwise -->
|
||||
<enumeration value="NAMED_OR_INLINED"/>
|
||||
|
||||
<!-- Execute statements with inlined parameters -->
|
||||
<enumeration value="INLINED"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="StatementType">
|
||||
<restriction base="string">
|
||||
|
||||
<!-- Execute statements with inlined bind values, avoiding JDBC's
|
||||
PreparedStatements -->
|
||||
<enumeration value="STATIC_STATEMENT"/>
|
||||
|
||||
<!-- Execute statements with bind values, using JDBC's
|
||||
PreparedStatements -->
|
||||
<enumeration value="PREPARED_STATEMENT"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="RenderNameStyle">
|
||||
<restriction base="string">
|
||||
|
||||
<!-- Render object names quoted, as defined in the database. Use this
|
||||
to stay on the safe side with case-sensitivity and special
|
||||
characters. For instance:
|
||||
Oracle : "SYS"."ALL_TAB_COLS"
|
||||
MySQL : `information_schema`.`TABLES`
|
||||
SQL Server: [INFORMATION_SCHEMA].[TABLES] -->
|
||||
<enumeration value="QUOTED"/>
|
||||
|
||||
<!-- Render object names, as defined in the database. For instance:
|
||||
Oracle : SYS.ALL_TAB_COLS
|
||||
MySQL : information_schema.TABLES
|
||||
SQL Server: INFORMATION_SCHEMA.TABLES -->
|
||||
<enumeration value="AS_IS"/>
|
||||
|
||||
<!-- Force rendering object names in lower case. For instance:
|
||||
Oracle : sys.all_tab_cols
|
||||
MySQL : information_schema.tables
|
||||
SQL Server: information_schema.tables -->
|
||||
<enumeration value="LOWER"/>
|
||||
|
||||
<!-- Force rendering object names in upper case. For instance:
|
||||
Oracle : SYS.ALL_TAB_COLS
|
||||
MySQL : INFORMATION_SCHEMA.TABLES
|
||||
SQL Server: INFORMATION_SCHEMA.TABLES -->
|
||||
<enumeration value="UPPER"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="RenderKeywordStyle">
|
||||
<restriction base="string">
|
||||
|
||||
<!-- Keywords are rendered "as is", i.e. mostly in lower case. For instance:
|
||||
select .. from .. where .. -->
|
||||
<enumeration value="AS_IS"/>
|
||||
|
||||
<!-- Keywords are rendered in lower case. For instance:
|
||||
select .. from .. where .. -->
|
||||
<enumeration value="LOWER"/>
|
||||
|
||||
<!-- Keywords are rendered in upper case. For instance:
|
||||
SELECT .. FROM .. WHERE .. -->
|
||||
<enumeration value="UPPER"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="BackslashEscaping">
|
||||
<restriction base="string">
|
||||
|
||||
<!-- Use the JDBC connection's setting for backslash escaping. In most databases, this
|
||||
is the same as OFF. In MySQL and MariaDB, the actual setting is extracted.
|
||||
|
||||
This is not yet implemented, as the JDBC connection might not be available to the renderer
|
||||
<enumeration value="AUTO"/>
|
||||
-->
|
||||
|
||||
<!-- Use the database's most sensible default value for ON (MySQL, MariaDB) / OFF (all other databases) -->
|
||||
<enumeration value="DEFAULT"/>
|
||||
|
||||
<!-- Always escape backslashes. -->
|
||||
<enumeration value="ON"/>
|
||||
|
||||
<!-- Never escape backslashes. -->
|
||||
<enumeration value="OFF"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</schema>
|
||||
Loading…
Reference in New Issue
Block a user