Will break you neck sooner or later.
e.g. because toSet() creates a hashset which has to get the hash, which will recurse into the (lazy loaded) collections of the Entity - and breaks with some exception:
Unexpected error occurred: failed to lazily initialize a collection of role: de.debuglevel.walkingdinner.backend.organisation.Organisation.dinners, could not initialize proxy - no Session
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: de.debuglevel.walkingdinner.backend.organisation.Organisation.dinners, could not initialize proxy - no Session
...
at org.hibernate.collection.internal.PersistentSet.hashCode(PersistentSet.java:458)
at de.debuglevel.walkingdinner.backend.organisation.Organisation.hashCode(Organisation.kt)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.put(HashMap.java:612)
at java.util.HashSet.add(HashSet.java:220)
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1294)
at kotlin.collections.CollectionsKt___CollectionsKt.toSet(_Collections.kt:1346)
at de.debuglevel.walkingdinner.backend.organisation.OrganisationService.getAll(OrganisationService.kt:22)
Will break you neck sooner or later. e.g. because
toSet()
creates a hashset which has to get the hash, which will recurse into the (lazy loaded) collections of the Entity - and breaks with some exception:Also add something to DEVELOPMENT.md