i am using user role relationship using hibernate that is available on so many websites.
But In my case user table already having users and roles table also having all the predefined roles.

Now what i want is to fetch all the available roles from roles table and check box as "checked" if it is available to the given user_id in third table(user_role).

有帮助吗?

解决方案

You have to make your Entity classes to use exist tables and columns names using name attribute in @Table and @Column, then the relation will be @OneToMany at user entity to the authorities entity with for ex Set<Role>, then in view you can make your check to know if this user have a specific role or not.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top