本文整理汇总了Java中org.hibernate.Session.refresh方法的典型用法代码示例。如果您正苦于以下问题:Java Session.refresh方法的具体用法?Java Session.refresh怎么用?Java Session.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.Session
的用法示例。
在下文中一共展示了Session.refresh方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveToHistory
import org.hibernate.Session; //导入方法依赖的package包/类
public void moveToHistory(Step step, int actionId, Date finishDate, String status, String actor) throws WorkflowStoreException {
Session session = null;
try {
session = sessionFactory.openSession();
session.refresh(step);
super.markFinished(step, actionId, finishDate, status, actor);
update(session, step);
HibernateStep currentStep = (HibernateStep)step;
HibernateStep historyStep = new HibernateHistoryStep(currentStep);
HibernateProcessInstance entry = currentStep.getEntry();
entry.removeCurrentStep(currentStep);
entry.addHistoryStep(historyStep);
// Session transaction managed by the delete, save and update DAO methods
delete(session, currentStep);
save(session, historyStep);
update(session, entry);
if(logger.isDebugEnabled()) {
logger.debug(historyStep.toString());
logger.debug(entry.toString());
}
} catch(HibernateException hibernateException) {
throw new WorkflowStoreException(hibernateException);
} finally {
if (session != null)
session.close();
}
// Logging the results of this action
}
示例2: addGoods
import org.hibernate.Session; //导入方法依赖的package包/类
/**
* 新增商品信息
*
* @param goods8 商品实体类
* @param goodsType8 商品类型实体类
* @return 返回新增具体类
*/
@Override
public FrameWorkDSCResult addGoods(final Goods8JPA goods8,
final GoodsType8JPA goodsType8)
{
FrameWorkDSCResult result = new FrameWorkDSCResult();
try
{
setSession(null);
Session session = SessionBasic.session;
//User8JPA user = goods8.getUser8JPA();
//user.getGoods8JPASet().add(goods8);
//goods8.setUser8JPA(user);
//goods8.setGoodsType(goodsType8);
//goodsType8.getGoods8JPASet().add(goods8);
session.merge(goods8);
//更新商品类型信息
session.refresh(goodsType8);
//session.refresh(user);
getTransaction().commit();
result.setDaoFlag(true);
}
catch (Exception ex)
{
result.setDaoFlag(false);
printStackTrace(ex);
result.setDaoException(ex);
}
finally
{
return result;
}
}
示例3: put
import org.hibernate.Session; //导入方法依赖的package包/类
public T put(T obj) {
Session session = DatabaseConnectionHandler.getInstance().beginTransaction();
session.saveOrUpdate(obj);
session.flush();
session.refresh(obj);
DatabaseConnectionHandler.getInstance().commitTransaction();
return obj;
}
示例4: refresh
import org.hibernate.Session; //导入方法依赖的package包/类
/**
* Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement
* long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.
*/
public void refresh(T obj, Session s) {
s.refresh(obj);
}