我的资源实体具有如下属性:
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "CMS_RESOURCE_USER_PERMISSION", joinColumns = @JoinColumn(name = "RESOURCE_ID", referencedColumnName = "ID"))
@MapKeyJoinColumn(name = "USER_ID", nullable = false)
@Enumerated(EnumType.STRING)
@Column(name = "PERMISSION", length = 50, nullable = false)
protected Map<User, ResourcePermission> userPermissions = new HashMap<User, ResourcePermission>();
现在我想按用户获取资源,我该怎么做?有什么建议吗?感谢先进。