Thursday, August 27, 2015

Re: LazyInitializationException when doing RPC on GWT

Dani,

Most likely the Hibernate session was already closed when you wanted to access the list. The code that handles the serialization of the list will need to access the list and needs a hibernate session to lazy load the data. Solution is to keep the session open or to set the loading strategy to non-lazy.

Regards.
  Arjan

Op donderdag 27 augustus 2015 08:04:27 UTC+2 schreef Dani Fujii:
Hello.
I need some help with this exception when using GWT. I've read so much about this issue yet I still don't understand why it happens to me. 
The exception is generated when returning a List in the method on the server-side Service Implementation (implementation for doing an RPC call). I'm using Comet: when I want to load data from the database, Comet calls the client-side Service interface method for doing so. 

    gameService.loadArguments(game, player, new AsyncCallback<List<ToulminDTO>>() {
 
@Override
 
public void onSuccess(List <ToulminDTO> result) {
 gameman
.loadArguments(result);
 
}
 
 
@Override
 
public void onFailure(Throwable caught) {
 
}
 
});

As I print a message on the onFailure method, I realize that the problem is when the server-side Service Impl does the "return list". 
I have even done DTO classes for all of the objects that Hibernate saves (as recommended on the GWT guides) but it hasn't solved the issue. What is even more weird is that the exception just happens in some moments. I'm using this on a Game, and in some rounds I am able to load data completely fine, yet in others the exception occurs.
Hope you can help me.
Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment