Hi,
is there a way to prevent an ajax request to call a method too much times ?
Indeed, I have an inputText with a search string and an ajax support calling a query() method on blur event. The problem occurs when the database contains too much data, and the query method is called too many times.
Is that possible to make this method synchronized ? or just ignore query() calls untill the last ended ?
my exception is :
Caused by: org.hibernate.AssertionFailure: collection was processed twice by flush() at org.hibernate.engine.Collections.prepareCollectionForUpdate(Collections.java:202) at org.hibernate.engine.Collections.processReachableCollection(Collections.java:185) at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61) at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:138) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64) at com.gpec.PersonManagerAction.queryPersons(PersonManagerAction.java:67)
You can put a queue and delay on the ajax request, and you can use concurrent request timeouts on conversation scoped components in Seam. Seam 2.0.0.CR2 docs contain some information on concurrent access to conversation scoped components.