[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-929) cascading in wrong order

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:46 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-929.
------------------------------


Closing stale resolved issues

> cascading in wrong order
> ------------------------
>
>                 Key: HHH-929
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-929
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1 beta 2
>         Environment: SQL SERVER
>            Reporter: Martin Zdila
>            Priority: Minor
>
> Hello
> See the mappings at the end of this post. In short: BusinessCase hasTable and Widgets. Widget  has WidgetType. WidgetType can have TableColumn. TableColumn has reference to Table.
> I use database with constrained relations so the order of deleting / saving / updating is important.
> CASE 1 with session.delete(businessCase) or CASE 2 with session.saveOrUpdate(businessCase) causes JDBC Exception:
> org.hibernate.PropertyValueException: not-null property references a null or transient value: com.kovine.kfe.dao.TableColumn.table
> 	at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
> There seems to be a problem with cascading order. I was a bit suprised the order of XML entities in hbm cares.
> In CASE 1 there helps deleting all Widgets (which use WidgetType with TableColumn) before BusinessCase.
> In CASE 2 there helps flushing new BusinessCase before adding new Widgets (which use WidgetType with TableColumn).
> PS: I have no time to provide any testcase :-/
> Here are the mappings:
> <hibernate-mapping package="com.kovine.kfe.dao">
> 	<class name="BusinessCaseImpl" table="KFE_BUSINESS_CASE" abstract="true" proxy="BusinessCase">
> 		...
> 		<!-- auxiliary relation -->
> CASE 1 -->	<one-to-one name="table" property-ref="businessCase" cascade="all" constrained="false" />
> 		<bag name="widgets" table="KFE_WIDGET" order-by="SORT_ORDER" inverse="true" cascade="all">
> 			<key column="BUSINESS_CASE_ID" />
> 			<one-to-many class="WidgetImpl" />
> 		</bag>
> 		<!-- auxiliary relation -->
> CASE 2 -->	<one-to-one name="table" property-ref="businessCase" cascade="all" constrained="false" />
> 		...
> 						
> 		<joined-subclass table="KFE_BUSINESS_CASE_SINGLE" name="BusinessCaseSingleImpl" proxy="BusinessCaseSingle">
> 			...
> 		</joined-subclass>
> 		<joined-subclass table="KFE_BUSINESS_CASE_TABLE" name="BusinessCaseTableImpl" proxy="BusinessCaseTable">
> 			...
> 		</joined-subclass>
> 	</class>
> </hibernate-mapping>
> <hibernate-mapping>
> 	<class name="com.kovine.kfe.dao.Table" table="KFE_TABLE">
> 		...
> 		<many-to-one unique="true" class="com.kovine.kfe.dao.BusinessCaseImpl" name="businessCase" column="BUSINESS_CASE_ID" not-null="true" embed-xml="false" node="@refId" />
> 		
> 		...
> 	</class>
> </hibernate-mapping>
> <hibernate-mapping>
> 	<class name="com.kovine.kfe.dao.WidgetImpl" proxy="com.kovine.kfe.dao.Widget" table="KFE_WIDGET" abstract="true">
> 		...
> 		<one-to-one name="widgetType" class="com.kovine.kfe.dao.WidgetType" cascade="all" />
> 		
> 		<many-to-one class="com.kovine.kfe.dao.BusinessCaseImpl" name="businessCase" column="BUSINESS_CASE_ID" not-null="true" embed-xml="false" node="@refId" />
> 		
> 		<joined-subclass name="com.kovine.kfe.dao.WidgetForSingleImpl" proxy="com.kovine.kfe.dao.WidgetForSingle" table="KFE_WIDGET_FOR_SINGLE">
> 			...
> 		</joined-subclass>
> 		<joined-subclass name="com.kovine.kfe.dao.WidgetForTableImpl" proxy="com.kovine.kfe.dao.WidgetForTable" table="KFE_WIDGET_FOR_TABLE">
> 			...
> 		</joined-subclass>
> 	</class>
> </hibernate-mapping>
> <hibernate-mapping package="com.kovine.kfe.dao">
> 	<class name="WidgetType" table="KFE_WIDGET_TYPE_ABSTRACT" abstract="true" lazy="false">
> 		...
> 		<one-to-one name="widget" class="WidgetImpl" constrained="true" embed-xml="false" node="@refId" />
> 		
> 		<joined-subclass name="WidgetTypePicture" table="KFE_WIDGET_TYPE_PICTURE" lazy="false">
> 			...
> 		</joined-subclass>
> 		...
> 		<joined-subclass name="WidgetTypeUsingColumn" table="KFE_WIDGET_TYPE_USING_COLUMN" abstract="true" lazy="false">
> 			<key column="WIDGET_ID" />
> 			<many-to-one unique="true" name="tableColumn" class="TableColumn" cascade="all" column="TABLE_COLUMN_ID" not-null="true" />
> 			...
> 			<joined-subclass name="WidgetTypeText" table="KFE_WIDGET_TYPE_INPUTTEXT" lazy="false">
> 				...
> 			</joined-subclass>
> 			...
> 		</joined-subclass>
> 	</class>
> </hibernate-mapping>

-- 
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