Package org.hibernate

Examples of org.hibernate.Session.refresh()


    return session.createQuery(hql);
  }

  public void refresh(final Object f) {
    final Session session = getSession();
    session.refresh(f);
  }

  public void registerAnnotatedClass(final Class<?> clazz) {
    if (clazz != null) {
      _log.info("registerAnnotatedClass " + clazz.getName());
View Full Code Here


  /** {@inheritDoc} */
  @Override
  public void refresh(@NotNull final E o) {
    Session session = getCurrentSession();
    try {
      session.refresh(o);
    } catch (final HibernateException e) {
      throw convertHibernateAccessException(e);
    }
  }

View Full Code Here

      if ( !session.contains( entity ) ) {
        throw new IllegalArgumentException( "Entity not managed" );
      }
      if ( lockModeType != null ) {
        lockOptions = getLockRequest( lockModeType, properties );
        session.refresh( entity, lockOptions );
      }
      else {
        session.refresh( entity );
      }
    }
View Full Code Here

      if ( lockModeType != null ) {
        lockOptions = getLockRequest( lockModeType, properties );
        session.refresh( entity, lockOptions );
      }
      else {
        session.refresh( entity );
      }
    }
    catch ( MappingException e ) {
      throw new IllegalArgumentException( e.getMessage(), e );
    }
View Full Code Here

            //QJ: Use Hibernate Criteria for more secured functionalities
            rs=(Preferencia) session.createCriteria(Preferencia.class)
                     .add(Restrictions.eq("idPreferencia", idPreferencia))
                     .uniqueResult();
            if(rs!=null)session.refresh(rs);
            tx.commit();
        }catch(HibernateException e){
            e.printStackTrace();
        }finally{
            session.close();
View Full Code Here

            rs=(List)session.createCriteria(Preferencia.class)
                     .add(Restrictions.eq("usuario.idUsuario", idUsuario))
                     .add(Restrictions.eq("buscaOfrece", buscaOfrece))
                     .list();
            for(int i=0;i<rs.size();i++){
                session.refresh((Preferencia)rs.get(i));
            }
            tx.commit();
        }catch(HibernateException e){
            e.printStackTrace();
        }finally{
View Full Code Here

                     .add(Restrictions.eq("usuario.idUsuario", idUsuario))
                     .add(Restrictions.eq("buscaOfrece", buscaOfrece))
                     .add(Restrictions.eq("conocimiento.idConocimiento", idConocimiento))
                     .list();
            for(int i=0;i<rs.size();i++){
                session.refresh((Preferencia)rs.get(i));
            }
            tx.commit();
        }catch(HibernateException e){
            e.printStackTrace();
        }finally{
View Full Code Here

        Session session = HibernateUtil.getSessionFactory().openSession();
        Transaction tx = session.beginTransaction();
        try {
            session.flush();
            Integer p = (Integer) session.save(preferencia);
            session.refresh(preferencia);
            tx.commit();

            log.info("end addPreferencia");
            return p;
        } catch (HibernateException e) {
View Full Code Here

        }
      }

      aSession.flush();
      // reload object
      aSession.refresh(hibBIObject);

      // if the object is no more referenced in any folder, erases it from sbi_obejcts table
      hibObjFuncs = hibBIObject.getSbiObjFuncs();
      if (hibObjFuncs == null || hibObjFuncs.size() == 0) {
View Full Code Here

      while (it.hasNext()) {
        SbiEventRole eventRole = (SbiEventRole) it.next();
        SbiEventsLog event = eventRole.getId().getEvent();
        aSession.delete(eventRole);
        aSession.flush();
        aSession.refresh(event);
        Set roles = event.getRoles();
        if (roles.isEmpty()) {
          aSession.delete(event);
        }
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.