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.

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

Environment

None

Activity

Show:

Frédéric Delaporte October 5, 2017 at 11:46 AM

Your are welcome to contribute. Please make sure you follow guidelines from contributing.md file. You already have the Jira, which is great.

About tests, there are already some tests about those properties, like WhenSetUpdateThenSetAttributes in NHibernate.Test.MappingByCode.MappersTests.PropertyMapperTest. So it seems some tests are missing, and need to be added.

About the classes, they are generated code. Avoid editing them manually. Instead follow How to generate Hbm.generated.cs.txt.

It should be noted that the actual feature provided by those update and insert attribute still works as expected even when they are not set, treating them as if they were true, because the feature checks if they were explicitly defined, and if no, disregards their actual value and considers them true.

Now for correctness it would still be better to have their default value correctly set in the xsd schema.

Pinned fields
Click on the next to a field label to start pinning.
Details

Assignee

Unassigned

Reporter

Sanjeev Sinha

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created October 5, 2017 at 6:20 AM
Updated October 5, 2017 at 11:47 AM
Who's Looking?
Loading...