Hibernateproxy after use


I have an application that is a socket server that accepts connections from mobile Android clients. When customers submit incorrect login information, NoResultException will be thrown.

Then I go back and close the entity manager. The user then enters the correct login information, the server is collecting data with some org.hibernate.proxy.hibernateproxy entities, this does not happen if the first login is correct.

The strange thing is that the queries only work again after the socket connection is restarted. Although it is the same entity management factory.

However I changed it to try the entityManager.find method and this works fine.

I am using the libs of 5.4.3, postgresql 9.1 and newer postgresql drivers.

I have tried almost all.

Thank you,