From: NHibernate J. <mik...@us...> - 2006-10-24 04:41:42
|
[ http://jira.nhibernate.org/browse/NH-767?page=all ] Sergey Koshcheyev closed NH-767: -------------------------------- Resolution: Fixed This is fixed in the current SVN already. I don't know of a workaround... > Delete fails when using nullable component properties > ----------------------------------------------------- > > Key: NH-767 > URL: http://jira.nhibernate.org/browse/NH-767 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Lukas Macedo > Priority: Trivial > > On the AbstractEntityPersister class, the GenerateDeleteStrings(object[] loadedState) method has an issue when dealing with entities that have been mapped with components where component properties can be null. See the code below: > bool include = versionability[i] && > IsPropertyOfTable(i, j); > if (include) > { > // this property belongs to the table and it is not specifically > // excluded from optimistic locking by optimistic-lock="false" > string[] propertyColumnNames = GetPropertyColumnNames(i); > if (loadedState[i] == null) > { > for (int k = 0; k < propertyColumnNames.Length; k++) > { > delete.AddWhereFragment(propertyColumnNames[k] + " is null"); > } > } > else > { > delete.AddWhereFragment(propertyColumnNames, PropertyTypes[i], " = "); > } > } > The problem is that the component property "loadedState[i]" itself will never be null and therefore when using optmistic-lock, it will end up generating a sql statement where fields are compared to null like this one: "field_one = null" this will fail and reported as stale data exception. The same issue applies to the method that generates update string when using optimistic-lock and components. > Is there any workaround? > Thank you, > Lukas -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |