当前位置: 首页>>代码示例>>Java>>正文


Java Session.refresh方法代码示例

本文整理汇总了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

    }
 
开发者ID:will-gilbert,项目名称:OSWf-OSWorkflow-fork,代码行数:41,代码来源:HibernateStore.java

示例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;
    }
}
 
开发者ID:SessionFactory,项目名称:tinyshop8,代码行数:44,代码来源:GoodsDAOImpl.java

示例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;
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:9,代码来源:PersistanceFacade.java

示例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);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:8,代码来源:_BaseRootDAO.java


注:本文中的org.hibernate.Session.refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。