playframework / play1

Play framework
https://www.playframework.com/documentation/1.4.x/home
Other
1.58k stars 682 forks source link

Better compatibility with Hibernate Envers #1432

Closed EddyVerbruggen closed 11 months ago

EddyVerbruggen commented 1 year ago

Purpose

When Hibernate Envers is triggered via an @Audited annotation, it attempts to insert a record in a related AUD table.

However, Play! assumes all related entities extend JPABase, which the AUD tables don't. This leads to a ClassCastException because HashMap is cast to JPABase.

By adding a check for JPABase here, we can avoid this problem. This effectively also checks for 'not null' which the previous implementation did.

aleksandy commented 1 year ago

@EddyVerbruggen, could you please provide a small test case demonstrating the problem? I've been using envers since play! 1.2.x and have never experienced this.

EddyVerbruggen commented 1 year ago

Hi @aleksandy! I'd love to, but if you can use it without problems and I can't then it's probably something in the configuration of my entities (or something deeper down the stack) which probably makes it pretty time consuming to come up with a good test case.

So before I do, can I ask you to consider the change on merit (outside the context of Envers)?

I mean, checking for instance of X before trying to cast to X (instead of the current 'not null' check) is arguably better anyway. And it fixes the Envers compatibility along the way for my app. 🙏

aleksandy commented 1 year ago

@EddyVerbruggen, I agree your point. But unfortunately I don't have enough rights for it.

@asolntsev, @xael-fry, could you approve and merge PR?

EddyVerbruggen commented 1 year ago

Hi friends, at Combidesk we're huge fans of Play!(!). We're using Play 1 for a few of our backend systems and would love to have this PR merged and released.

Is there anything we can do to help drive this forward? As OSS maintainers ourselves we know it may be hard to find time and prioritise unpaid work, so we'd be happy to do a decent donation for your efforts as well.

Cheers, and keep up the great work!