Reputation: 56
I wanted to fire HQL queries from GWT client. But As it comes asynchronously, If I want to fire a sequence of queries, How do I do that?
Asynchronously all the data is transferred to client and used. But If I want to fire the queries in sequence how do I do that?
Mainly, the order of processing those HQL results should not be changed.
Let me know if you have any queries. Thanks in advance.
Upvotes: 0
Views: 158
Reputation: 2524
GWT is asynchronous so you have to build everything based on request->callback
You can do two things in a case like this:
Upvotes: 0
Reputation: 5293
Using Hibernate with GWT is not as simple as you may think. Google has a good documentation for the use of Hibernate. Did you already read that documentation?
I can recommend the use of Gilead. I'm not sure if this would solve your problem because I'm not exactly sure what your problem is.
Upvotes: 0
Reputation: 2940
GWT Client will fire your queries in the order you have defined in client file i.e
yourClient.java
Query q1; //execute method first request
Query q2; // execute method second request
The Queries will run on sequence first q1 then q2 but q2 will not wait for the completion of q1. Once request send you can not assure about the order inwhich you will get response it might be possible that q2 will execute and return the response first while q1 is in progress.
Mostly operations for making sequence from client side is bit expensive. i.e you can use the queries on success method of AsyncCallback. When response of q1 will comes then q2 will be executed but if you have several queries then its an expensive solution.
So best thing is that make a Service method execute your all queries at server side and return map of result then populate it in your client side in any sequence you want to show the data.
Upvotes: 1