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
老天 閱讀(384)
評論(1) 編輯 收藏