Hibernate - Query returns null for all fields in Entity
Long fooId = 39;
Query query = getCurrentSession().createQuery("from FooEntity where deleted IS FALSE AND id=:fooId" );
query.setParameter( "fooId", fooId );
FooEntity fooEntity = ( FooEntity ) query.uniqueResult();
Inspecting the FooEntity the following result is shown
(id=null, name=null, deleted=null)
While the same query returns perfect result from db
select * from foo where deleted IS FALSE AND id=39
(id, name, deleted) => (39, 'Bar', false)
It has to be noted that this occurs in random cases only. Most of the time hibernate returns perfect result.