]
Gail Badner commented on HHH-2731:
----------------------------------
Please attach a runnable test case (Java + mapping).
wrong delete statement for elements in collections with formula
properties
--------------------------------------------------------------------------
Key: HHH-2731
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2731
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4 sp1 with oracle 10
Reporter: Giorgio Massussi
I have mapped a collection of components in a class; the component declares a formula
property:
<class name="Master" table="MASTERS">
...
<set name="details" table="DETAILS"
cascade="persist,merge,save-update" >
<key>
...
</key>
<composite-element class="Detail">
....
<property name="formula" type="int" >
<formula>1</formula>
</property>
</composite-element>
</set>
</class>
Hibernate generates a delete statement with a wrong where clause on the formula column:
delete from DETAILS where [ .... ] and null = 1
I suspect that the problem is in the constructor of
org.hibernate.persister.collection.AbstractCollectionPersister: it calculates correctly
the set of columns to use in where clauses, excluding formula and nullable columns, but
then this fragment of code forces to keep all columns, including formulas
//workaround, for backward compatibility of sets with no
//not-null columns, assume all columns are used in the
//row locator SQL
if ( !hasNotNullableColumns ) {
Arrays.fill( elementColumnIsInPrimaryKey, true );
}
I suspect that there is the same error is in update statement.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: