Answering my own question.
So in short, what I was trying to do:
- Run application on WebSphere which we set up with Hibernate 3
- Test application on JBOSS 7 which is strongly bound to Hibernate 4
- Have the container provide the persistence
- Use a single Hibernate (non-JPA) construct (
UserType
s)
When deploying in WebSphere the UserType
in the application needed to be compatible with Hibernate 3, and when testing in JBOSS it needed to be compatible with Hibernate 4. As it turns out, the UserType
specification had changed just enough for it to be incompatible one way or another. (And if it hadn't it would still have been a bad idea to mix these versions, but it may have taken longer to become apparent.) This mix led to errors such as described in another question. But even with the accepted solution in that question I had a bunch of errors, worked around them with funky dependency management, but always kept having some sort of issue.
If JPA is the contract (between your application and your container) then don't rely on how the container implements that contract (e.g. Hibernate).
If I would provide the persistence from within the application, that'd be an entirely different story.
Sometimes when you're right in the middle of things it's hard to see the big picture :)