java使用Hibernate(注释)创建具有权限的简单用户/组模型
这很可能是一个非常基本的问题,但是:
基本上,用户实体有一个Id和一个特权枚举。 该组有一个id和一个名称
我想知道如何建立一个关系模型,其中一个用户可以在多个组中,在不同的组中拥有不同的权限级别。当然,每个小组都可以有多个成员
我用Hibernate惯用的解决方法是什么? 向用户添加一些成员字段?组的成员字段?二者都为它创建一个新类?将这些东西连接在一起需要哪些注释
你可以在下面搜索框中键入要查询的问题!
这很可能是一个非常基本的问题,但是:
基本上,用户实体有一个Id和一个特权枚举。 该组有一个id和一个名称
我想知道如何建立一个关系模型,其中一个用户可以在多个组中,在不同的组中拥有不同的权限级别。当然,每个小组都可以有多个成员
我用Hibernate惯用的解决方法是什么? 向用户添加一些成员字段?组的成员字段?二者都为它创建一个新类?将这些东西连接在一起需要哪些注释
# 1 楼答案
我使用了next architecture
用户实体类
AuthorityEntity类
事实上,这就是spring安全插件的实现方式。 在您的情况下,您可以实现该体系结构,这将对您更有用