0 Replies Latest reply on May 28, 2008 2:54 PM by Leonidas79

    Flex+dataservice+Hibernate

    Leonidas79
      i got this error when i try to add a second item using dataservice and
      hibernate.

      [RPC Fault faultString="Item with id 'markingHibernate:::0' already
      exists. Error on destination 'markingHibernate'"
      faultCode="Local.Call.Failed" faultDetail="null"]

      here is my code :

      public function markOffer(offreId:int,userId:int):void{
      var param:Array = new Array();
      param.push(offreId);
      param.push(userId);
      //resCheck.addEventListener(CollectionEvent.COLLECTION_CHANGE,checkMarking);
      var token:AsyncToken = markingHibernateService.fill(resCheck,"flex:hql","from Marking m where m.offre = ? and m.users = ?",param);
      token.action = "mark";
      token.taille = resCheck.length;
      }
      public function checkMarking(event:CollectionEvent):void{
      taille = event.target.length;
      }
      private function resultHandler(event:ResultEvent):void{
      if(event.token.action == "mark"){
      if(event.token.taille != 0){
      Alert.show("you already marked this offer , plz choose another one","Info");
      }else{
      var myMarking:Marking = new Marking();
      myMarking.users = usertest;
      myMarking.offre = dgOfferRes.selectedItem as Offre;
      myMarking.marked = "y";
      myMarking.reserved = "";
      markingHibernateService.createItem(myMarking);
      Alert.show("success marking","Info");
      }


      i hope u can help me.