samedi 9 janvier 2010

BlazeDS and LazyInitializationException

I suddenly realized that even though I was successfully implementing the save of the Game entity in the data base (using hibernate), the "load" part was being completely overlooked.
When I started testing it, I had lots of LazyInitializationExceptions on the client side.

I will not go in the details of how / why this occurs - there are already several places on the net where you can find some detailed explanations, like Get Out of My POJO. There are several ways to solve this issue with BlazeDS, like integrating a third-party framework like dpHibernate (I have not used it myself, so can for now only rely on what I have read).

I really did not want to do into integrating another library, or building something myself. I thought about it, and realized that for now lazy fetching is totally useless to me for communication with the client-side. Indeed, all the data is displayed as soon as the game is loaded, so the data will be needed immediately anyway.
This may change later on, when more services are implemented server-side, but I'll guess I'll be lazy myself and check this when time comes.

Aucun commentaire:

Enregistrer un commentaire