From: <leg...@at...> - 2003-06-13 09:28:30
|
Message: The following issue has been closed. Resolver: Gavin King Date: Fri, 13 Jun 2003 4:26 AM As described in the documentation, you must use unsaved-value="0" for a primitive id type. The User Forum is the correct place for these kinds of issues. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-133 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-133 Summary: Cascading a many-to-one child object in MYSQL Type: Bug Status: Closed Priority: Major Resolution: REJECTED Project: Hibernate2 Components: core Versions: 2.0 final Assignee: Gavin King Reporter: Todd Nine Created: Thu, 12 Jun 2003 1:38 PM Updated: Fri, 13 Jun 2003 4:26 AM Environment: Orion Application Server MY SQL DB Java 1.4.1_02 Description: This is a concrete example of the Cascades.isUnsaved(Serializable id) error. We have 2 class Customer and Address, Address is a child of Customer. if we have the following in the Customer.hbm.xml file: <many-to-one name="address" class="com.sigma.webtools.modal.services.facades.facadechildren.Address" cascade="all"/> and Address.hbm.xml is the following <hibernate-mapping> <class name="com.sigma.webtools.modal.services.facades.facadechildren.Address" table="WTS_ADDRESS"> <id name="id" type="long"> <generator class="native"/> </id> <property name="firstName" type="string"/> <property name="lastName" type="string"/> <property name="address1" type="string"/> <property name="address2" type="string"/> <property name="address3" type="string"/> <property name="city" type="string"/> <property name="state" type="string"/> <property name="zip" type="string"/> <property name="contact" type="string"/> <property name="deliveryType" type="string"/> <property name="addressType" type="string"/> </class> </hibernate-mapping> when the generator is "native" and the variable type is a primitive numberic, the following will return 0; //line 1210 in file net.sf.hibernate.impl.SessionImpl Serializable id = persister.getIdentifier(object); Therefore, when the following is called if ( persister.isUnsaved(id)) The following evaluates false return id==null; The child object will not be saved because an update is called instead of a save. --------------------------------------------------------------------- JIRA INFORMATION: 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/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |