0 Replies Latest reply on Apr 25, 2008 4:12 AM by (Thierry_Vionnet)

    delete sub-data from my valueObject

      I have the following mapping for my gabarit class : <br /><br /><?xml version="1.0"?><br /><!DOCTYPE hibernate-mapping PUBLIC<br />          "-//Hibernate/Hibernate Mapping DTD 3.0//EN"<br />          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><br /><hibernate-mapping><br /><br />     <class name="com.myapp.app.vo.GabaritVO" table="gabarit"><br />          <id name="id" column="gabaritid"><br />               <generator class="native"/><br />          </id><br />          <property name="name" column="gabaritname" /><br />          <property name="desc" column="gabaritdesc" /><br />          <br />          <set name="gabaritItems"><br />               <key column="gabaritid" /><br />               <one-to-many class="com.myapp.app.vo.GabaritItemVO" cascade="delete-orphan" /><br />          </set><br />     </class><br /><br />     <query name="all.gabarits">From GabaritVO</query><br /><br /></hibernate-mapping> <br /><br />My gabarit class is linked with nested association to GabaritItemVO class to get all gabaritItems for each gabarit. When I call the service to retrieve all gabarits, each gabarit has its own gabaritItems.<br /><br />Now when I try to delete some gabaritItems on a gabarit in flex, I have the following error : <br /><br />(mx.messaging.messages::ErrorMessage)#0<br />body = (null)<br />clientId = "4DD061F9-390B-4259-46A6-20BE31B0EDAF"<br />correlationId = "045AB24E-5BAA-0B7C-A642-850B61B41D28"<br />destination = "gabaritvo.hibernate"<br />extendedData = (null)<br />faultCode = "Server.Processing"<br />faultDetail = (null)<br />faultString = "Could not invoke sync method on data adapter for destination 'gabaritvo.hibernate' due to the following error: class org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update."<br />headers = (Object)#1<br />messageId = "4DD0CB78-0F1C-0126-3EFE-9E9196F37E51"<br />rootCause = (Object)#2<br />cause = (Object)#3<br />cause = (null)<br />errorCode = 1048<br />localizedMessage = "Column 'gabaritid' cannot be null"<br />message = "Column 'gabaritid' cannot be null"<br />nextException = (null)<br />SQLState = "23000"<br />updateCounts = (Array)#4<br />[0] -3<br />constraintName = (null)<br />errorCode = 1048<br />localizedMessage = "Could not execute JDBC batch update"<br />messages = (Array)#5<br />[0] "Could not execute JDBC batch update"<br />[1] "Column 'gabaritid' cannot be null"<br />SQL = "update gabarititem set gabaritid=null where gabaritid=? and gabarititemid=?"<br />SQLException = (Object)#3<br />SQLState = "23000"<br />throwableCount = 2<br />throwables = (Array)#6<br />[0] (Object)#2<br />[1] (Object)#3<br />timestamp = 1209117926015<br />timeToLive = 0<br /><br />I don't understand, because in the flex side, I made a "removeItemAt( index ) on the gabaritItems arrayCollection of my GabaritVO to remove some GabaritItemVO of the collection, and LCDS return to me that it made an update (update gabarititem set gabaritid=null where gabaritid=? and gabarititemid=?) instead of a delete. <br /><br />What is missing in my configuration ?? <br /><br />Any help would be appreciated.<br /><br />Thanks in advance<br /><br />Thierry