2 Replies Latest reply on Jul 2, 2008 9:37 AM by Leonidas79

    hanging request for an update using Hibernate and Mysql

    Leonidas79
      hi everyone.
      i'm using Hibernate,mysql and DS for so many tables and it works fine for CRUD , i have a problem with just one table when i try to update records , the request is hanging so long before it works , i don't know what's wrong , here some code that can help.

      <hibernate-mapping>
      <class name="com.sample.Marking" table="marking">
      <id name="markingId" type="java.lang.Integer">
      <column name="markingId" />
      <generator class="increment" />
      </id>
      <many-to-one name="users" class="com.sample.Users" fetch="select">
      <column name="userId" not-null="true" />
      </many-to-one>
      <many-to-one name="offre" class="com.sample.Offre" fetch="select">
      <column name="offreId" not-null="true" />
      </many-to-one>
      <property name="marked" type="java.lang.String">
      <column name="marked" length="1" not-null="true" />
      </property>
      <property name="reserved" type="java.lang.String">
      <column name="reserved" length="1" not-null="true" />
      </property>
      </class>
      </hibernate-mapping>


      public function reserv():void{
      CursorManager.setBusyCursor();
      var param:Array = new Array;
      param.push(offreIdFill);
      param.push(userIdFill);
      reserveMarking.addEventListener(CollectionEvent.COLLECTION_CHANGE,refreshReserv);
      token = markingHibernateService.fill(reserveMarking,"flex:hql","from Marking m where m.offre = ? and m.users = ?",param);
      token.action = "reserv";
      }
      public function refreshReserv(event:CollectionEvent):void{
      if(reserveMarking.length == 1){
      mark = reserveMarking.getItemAt(0) as Marking;
      }
      }

      private function resultHandler(event:ResultEvent):void{
      if(event.token.action == "reserv"){
      mark.reserved = "y";
      markingHibernateService.commit();
      CursorManager.removeBusyCursor();
      Alert.show("offer reserved with succes","info");
      }
      }

      <mx:DataService id="markingHibernateService" autoCommit="true" destination="markingHibernate" result="resultHandler(event)"/>

      i hope it can help. thx