Friday, March 29, 2013

JPA Versioning - Hibernate Envers

Hibernate Envers and a HashMap to Long Exception

a frequent exception i was hitting recently when trying to implement Hibernate Envers was a confusing one about problems casting a HashMap to a Long.  after digging around a bit i found that i had a field in my entity that was called 'originalId'.  thanks to a bit of searching on the Hibernate forum, this was identified as the cause. presto chango - field is renamed and problem goes away.

tl;dr - if you see the casting exception, check that you don't have 'originalId' in your entity.

No comments:

Post a Comment