flushvisitor.java
来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 45 行
JAVA
45 行
//$Id: FlushVisitor.java,v 1.1.2.1 2003/11/27 11:57:30 oneovthafew Exp $
package net.sf.hibernate.impl;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.type.PersistentCollectionType;
/**
* Process collections reachable from an entity. This
* visitor assumes that wrap was already performed for
* the entity.
*
* @author Gavin King
*/
class FlushVisitor extends AbstractVisitor {
private Object owner;
Object processCollection(Object collection, PersistentCollectionType type)
throws HibernateException {
if (collection!=null) {
SessionImpl session = getSession();
final PersistentCollection coll;
if ( ( (PersistentCollectionType) type ).isArrayType() ) {
coll = session.getArrayHolder(collection);
}
else {
coll = (PersistentCollection) collection;
}
session.updateReachableCollection(coll, type, owner);
}
return null;
}
FlushVisitor(SessionImpl session, Object owner) {
super(session);
this.owner = owner;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?