Spring & Hibernate: block user from writing

I need one user not to write to the database, is there any way to achieve this without changing all save or update cases? I thought I need to wrap the hibernate session. What would you advise me to do?

thanks Sebastian


source to share

2 answers

I ended up using the Hibernate interceptor. If I implement onSave (), onDelete () and onFlushDirty (), is there any way to bypass these methods and write to db? If not, I am very happy with this solution. Because, as it turns out, that user is not allowed to read some of the fields.



I recommend using a security framework like Spring Security or Apache Shiro to implement cross-cutting security concerns at the application level.



All Articles