Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

hanging request for an update using Hibernate and Mysql

Avatar

Level 1
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
2 Replies

Avatar

Level 2
Hi,



Can you please try handling the Fault event of the
DataService and see if there is any error thrown. Looks like you
are setting the busy cursor and are removing it only when the
Result event is invoked. So, there might be a possibility that the
Fault even is invoked, which we are not handling in our case and
the busy cursor is not removed.



Hope this helps.

Avatar

Level 1
thx for ur answer , but it's hanging also without the busy
cursor ,there is no fault while updating the data , the problem is
that it's hanging and took long time before updating , i don't know
if there is something wrong with the mapping or the database.

thx