Hello Tomas Cerskus, thanks for reporting the issue! I ran some tests with you reproducer and I can say that the problem only occurs when accessing fields with the dot notation (e.g. order.user.id) but it doesn’t happen when using getter methods (order.getUser().getId()). This is due to how Hibernate fetches and initializes associated entities. With version 5 it only worked for this particular case because the order of initialization for associated entities was different and order.user was not a HibernateProxy, but this is purely by chance (different property names / JVM could change this behavior). Even in Hibernate 5, if you try setting the association to LAZY and manually initializing the user property (calling for example order.getUser().getName()), you will see that accessing the field with the dot notation still yields null, but using getter methods the values are correct. Using getter methods for properties should solve all issues. Let me know if I can help you with anything else. |