insert and update default value for property differ from its documentation.

Description

As per the documentation, the class <property> insert and update attributes are optional and their default value is true.

(4)
update, insert (optional - defaults to true) : specifies that the mapped columns should be included in SQL UPDATE and/or INSERT statements. Setting both to false allows a pure "derived" property whose value is initialized from some other property that maps to the same column(s) or by a trigger or other application.

But when we deserialize .hbm file to HbmClass whose property is not set (that means it should be true by default) it shows false value with the HbmProperty's insert and update. This contradicts the documentation. Actually it should have been true.

Here is the actual places where changes needs to be done.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 <xs:element name="property"> <xs:complexType> <xs:sequence> <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded" /> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="column" /> <xs:element ref="formula" /> </xs:choice> <xs:element ref="type" minOccurs="0" /> </xs:sequence> <xs:attribute name="name" use="required" type="xs:string" /> <xs:attribute name="node" type="xs:string" /> <xs:attribute name="access" type="xs:string" /> <xs:attribute name="type" type="xs:string" /> <xs:attribute name="column" type="xs:string" /> <xs:attribute name="length" type="xs:positiveInteger" /> <xs:attribute name="precision" type="xs:positiveInteger" /> <xs:attribute name="scale" type="xs:nonNegativeInteger" /> <xs:attribute name="not-null" type="xs:boolean"> </xs:attribute> <xs:attribute name="unique" default="false" type="xs:boolean"> </xs:attribute> <xs:attribute name="unique-key" type="xs:string" /> <xs:attribute name="index" type="xs:string" /> <!-- Here, missing default="true" on two next attributes --> <xs:attribute name="update" type="xs:boolean"> </xs:attribute> <xs:attribute name="insert" type="xs:boolean"> </xs:attribute> <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"> </xs:attribute> <xs:attribute name="formula" type="xs:string" /> <xs:attribute name="lazy" default="false" type="xs:boolean"> </xs:attribute> <xs:attribute name="generated" default="never" type="propertyGeneration"> </xs:attribute> </xs:complexType> </xs:element>
1 2 3 4 5 6 7 public HbmProperty() { this.unique = false; this.optimisticlock = true; this.lazy = false; this.generated = HbmPropertyGeneration.Never; // Here, lacking update and insert initialization. }

As we know where to fix, so moderator will agree we can submit the solution.

Environment

None

Status

Assignee

Unassigned

Reporter

Sanjeev Sinha

Labels

None

Components

Affects versions

4.1.1

Priority

Minor
Configure