Hi All,
Checking the code, I realised that REST services can throw LazyInitializationException when the code is trying to access a relationship. The transaction has been completed but the code is accessing a lazy relationship which requires a transaction.
To replicate the issue, in web.rest.AccountResource.getAccount(HttpServletResponse) I added the following line:
log.debug("User authorities size: " + user.getAuthorities().size());
Then, I logged in the app and in the log I saw the following exception:
[ERROR] ar.com.tunuyan.conf.DispatcherServletConfiguration - An error has occured: failed to lazily initialize a collection of role: ar.com.tunuyan.domain.User.authorities, could not initialize proxy - no Session
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ar.com.tunuyan.domain.User.authorities, could not initialize proxy - no Session
at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:566)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:186)
at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:137)
at org.hibernate.collection.internal.PersistentSet.size(PersistentSet.java:156)
at ar.com.tunuyan.web.rest.AccountResource.getAccount(AccountResource.java:53)