我是Shiro的新手,我想使用它来保护我的Web应用程序.我测试了它的各种功能.
我也测试过了
[urls]
/login.xhtml = authc
/logout = logout
/admin/** = user, roles[admin]
/guest/** = user, roles[admin,guest]
Run Code Online (Sandbox Code Playgroud)
但在我的应用程序中,我想动态配置此部分.我找到了一些解决方案,比如动态创建Ini实例或实现但是它们无法解决我的问题.请提供我的建议或出路.一些代码片段会更好
Shiro提供了缓存功能,但就我而言,我正在为用户使用动态角色和权限.我需要使特定用户的缓存过期(如果有),以便权限的更改立即影响用户.
Realm中有一个方法,但是如何获取关联领域的实例来调用方法来清除缓存.
我想使用公式注释获取实体对象
@Formula(value="(select ar from article ar where ar.id=1)")
private Article article;
Run Code Online (Sandbox Code Playgroud)
尝试了很多方法。请帮忙
线程“main”org.hibernate.MappingException 中的异常:无法确定类型:com.test.bean.Article,在表:菜单,对于列:[org.hibernate.mapping.Formula((从文章 ar 中选择 ar ar.id=1) )]
异常似乎说它无法解析类型
更新实体
@Entity
public class Menu {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
// @Formula(value="article.id=1")
// @JoinColumnOrFormula(formula=@JoinFormula("(select ar from article ar where ar.id=1)"),column=@JoinColumn(insertable=false,updatable=false))
// @Transient
// @OneToOne(fetch=FetchType.EAGER,targetEntity=Article.class)
// @JoinColumn(insertable=false,updatable=false,columnDefinition="(select ar from article ar where ar.id=1)")
@Formula(value = "(SELECT ar.id from article ar where ar.id=1)")
// @OneToOne(targetEntity=Article.class,fetch=FetchType.EAGER)
// @Fetch(FetchMode.SELECT)
private Article article;
@Formula(value = "(SELECT count(*) from article ar where ar.id=1)") …Run Code Online (Sandbox Code Playgroud)