Hi folks
I have an existing PostgreSQL 8.4 database I'm connecting to via Hibernate (using JPA2 Annotation-based mappings). The DB uses column priveleges to control what different user roles are allowed to do. Hibernate connects as the application user, so it is subject to those permissions checks.
My problem is that I don't know how to map columns where the column may or may not be insertable / updatable depending on the priveleges of the user whose credentials were used to create the SessionFactory.
Is there any way to change the `updatable' and `insertable' (JPA2) attributes of an entity mapping at runtime? Or some other smarter way to handle this?
I know I could build a fully dynamic XML mapping if I was using Hibernate directly (
https://www.hibernate.org/171.html) but is there any less drastic middle ground availabile?
Has anyone tried using @Persister to extend org.hibernate.persister.EntityPersister for column-permission awareness, for example?