JLEFE1 / rankmygame

Project to store game results
Apache License 2.0
0 stars 1 forks source link

Saving update player not working anymore #16

Closed JLEFE1 closed 9 years ago

JLEFE1 commented 9 years ago

When updating a player, the save action returns following stacktrace:

HTTP Status 500 - Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.homegrown.domain.Player.playerResults; nested exception is org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.homegrown.domain.Player.playerResults ...

JLEFE1 commented 9 years ago

player result list was not eagerly loaded. setting fetch type to EAGER didn't help.

Solved this problem by getting correct player from db and copy his playerResults in the attached entity. This is probably not the best solution.

JLEFE1 commented 9 years ago

Solved this by getting the data when necessary. The problem is that when you update the name, only this field should be changed. But the player is collected from a List where the playerresults are "apparently" lazy loaded. This way the list = null when you get one player. This will then cause the problem.