NutzCN Logo
精华 Nutz懒加载异常
发布于 3132天前 作者 Longitude 2012 次浏览 复制 上一个帖子 下一个帖子
标签:

关联对象:

@One(target = Menu.class, field = "menuId")
	private Menu menu;

	@At("/queryMenu")
	public Object queryMenu(Integer roleId){
		return roleMenuService.query(null).get(0).getMenu();
	}
	
	2016-5-26 13:1:54.385 DEBUG [http-nio-8081-exec-2] SELECT * FROM t_wf_role_menu 
2016-5-26 13:1:55.3 WARN [http-nio-8081-exec-2] Error@/queryMenu :
java.lang.StackOverflowError
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:56)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.uwf.bean.wf.RoleMenu$$NUTZAOP.getMenu(RoleMenu.java:1)
	at cn.uwf.bean.wf.RoleMenu.hashCode(RoleMenu.java:12)
	at java.util.WeakHashMap.hash(WeakHashMap.java:298)
	at java.util.WeakHashMap.get(WeakHashMap.java:396)
	at org.nutz.dao.impl.ext.LazyAnnotationEntityMaker$LazyMethodInterceptor.filter(LazyAnnotationEntityMaker.java:129)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
13 回复

可重现问题的全部代码哦,不然怎么复现

看上去是 cn.uwf.bean.wf.RoleMenu.hashCode方法, 里面调用了getMenu导致递归了, 改成直接拿属性吧

可是我就是要用这整个对象。

@qq_5cfdd686 hashCode方法内的避免使用getter,应该就好了

怎么定义,我没有用Hashcode。。

整个 RoleMenu 类贴出来, 记得用菜单中的代码块.



@Data @Table("t_wf_role_menu") @Comment("功能菜单权限") public class RoleMenu { @Id @ColDefine(customType = "int") @Comment("ID") private Integer id; @Column("role_id") @ColDefine(customType = "int") @Comment("所属权限") private Integer roleId; @Column("p_menu_id") @ColDefine(customType = "int") @Comment("所属父级菜单") private Integer p_menu_id; @Column("menu_id") @ColDefine(customType = "int") @Comment("所属菜单") private Integer menuId; @Column("seq") @ColDefine(customType = "int") @Comment("序号") private Integer seq; @One(target = Menu.class, field = "menuId") private Menu menu; }

```java @EqualsAndHashCode(doNotUseGetters=true)

加一个注解

@EqualsAndHashCode(doNotUseGetters=true)

@wendal

@EqualsAndHashCode(doNotUseGetters=true)

是什么意思

@javanan lombok 的一个注解, 看上去有用,但一堆蛋疼问题的东西,哈哈, 曾经在公司项目用过,后来抛弃了, 收益比痛点少.

@wendal 您既然推荐这么蛋疼的东西给他用,,哈哈哈

@javanan 我哪里推荐了?@Data是他自己加的,加上我写的只是限制一下行为

添加回复
请先登陆
回到顶部