[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2731) wrong delete statement for elements in collections with formula properties

Gail Badner (JIRA) noreply at atlassian.com
Wed Oct 24 17:04:38 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28547 ] 

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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list