Data class hashcode for proxy fields out of transaction


#1

If data class is used as JPA Entity and entity is hashCode function is called out of transaction and proxy lazy fields exist, then LazyInitializationException is thrown as expected.

What should be the ideal solution to overcome this problem?

  • Overriding hashCode, equals function would be one solution.