2013-1-15
1、struts2 top关键字理解。
1).top 指代当前迭代元素,可以为对象;
2).这里的top可用[0].top替代,但不能使用[0];[0]代表整个栈对象。如果单纯调用[0]将会调用其 toString()方法输出对象信息;
2、删除信息时错误日志:
java.lang.IllegalArgumentException: Removing a detached instance
Detached - a detached instance is an object that has been persistent, but its Session has been closed. The reference to the
object is still valid, of course, and the detached instance might even be modified in this state. A detached instance can be
reattached to a new Session at a later point in time, making it (and all the modifications) persistent again
现在应该明白了吧,在删除之前把这个Detached instance绑定到当前的Sesssion,在用当前Sesssion删除此instance。修改后的代码如
解决办法:
public void delete(SASVo vo) {
entityManager.remove( entityManager.merge(vo));
}
posted on 2013-01-15 16:54
老天 阅读(376)
评论(1) 编辑 收藏