Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Flex+dataservice+Hibernate

Avatar

Level 1
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.
0 Replies