I’m using hibernate, I have a user entity, however I want it to implement the org.springframework.security.core.userdetails.UserDetails class. Inside this class, there is a method called “getAuthorities()” that needs to be implemented. Hibernate keeps thinking this is a method used to get an item that exists in the database, however I don’t have any “authorities” data holder.
So, I need a way that I can have a User object class that contains no data called “authorities” but contains a method called “getAuthorities()”. How can this be done?
Annotate the getter as @Transient. Hibernate will ignore it.
If you can access all of your other properties on your User object using field access rather than property access you can add @AccessType(“FIELD”) to your class. Then getters will not be used.