Package org.hibernate

Examples of org.hibernate.Session.refresh()


    // set dynamic score and reindex!
    session = openSession();
    session.beginTransaction();

    session.refresh( lib2 );
    lib2.setDynScore( 2.0f );

    session.getTransaction().commit();
    session.close();
View Full Code Here


    // index foobar
    session = openSession();
    session.beginTransaction();

    session.refresh( lib1 );
    lib1.setName( "foobar" );

    session.getTransaction().commit();
    session.close();
View Full Code Here

    try {

      Session currentSession = getSession();
      currentSession.flush();
      currentSession.refresh(r);
      if (r.getHistoricoGps() != null) {
        r.getHistoricoGps().getPosX();
        return r.getHistoricoGps();
      }
    } catch (Throwable t) {
View Full Code Here

            uniqueResult.getEstadoEurocop().getId();
          }
          if (uniqueResult.getFlotas() != null) {
            uniqueResult.setFlotas((Flota) currentSession.get(
                Flota.class, uniqueResult.getFlotas().getId()));
            currentSession.refresh(uniqueResult.getFlotas());
          }
          if (uniqueResult.getPatrullas() != null) {
            uniqueResult.setPatrullas((Patrulla) currentSession
                .get(Patrulla.class, uniqueResult
                    .getPatrullas().getId()));
View Full Code Here

    customer.setName( "other" );
    session.flush();
    assertFalse( "should-be-proxy was initialized", Hibernate.isInitialized( customer.getCompany() ) );

    session.refresh( customer );
    assertEquals( "name not updated", "other", customer.getName() );
    assertEquals( "company association not correct", "acme", customer.getCompany().getName() );

    session.getTransaction().commit();
    session.close();
View Full Code Here

    customer.setName( "Steve" );
    session = openSession();
    session.beginTransaction();
    session.update( customer );
    session.flush();
    session.refresh( customer );
    assertEquals( "name not updated", "Steve", customer.getName() );
    session.getTransaction().commit();
    session.close();

    // Test querying
View Full Code Here

    customer.setName( "other" );
    session.flush();
    assertFalse( "should-be-proxy was initialized", Hibernate.isInitialized( customer.getCompany() ) );

    session.refresh( customer );
    assertEquals( "name not updated", "other", customer.getName() );
    assertEquals( "company association not correct", "acme", customer.getCompany().getName() );

    session.getTransaction().commit();
    session.close();
View Full Code Here

    customer.setName( "Steve" );
    session = openSession();
    session.beginTransaction();
    session.update( customer );
    session.flush();
    session.refresh( customer );
    assertEquals( "name not updated", "Steve", customer.getName() );
    session.getTransaction().commit();
    session.close();

    // Test querying
View Full Code Here

    Session s = openSession();
    s.beginTransaction();
    CacheableItem item = new CacheableItem( "data" );
    s.save( item );
    s.flush();
    s.refresh( item );
    s.getTransaction().commit();
    s.close();

    Map cacheMap = getSessions().getStatistics().getSecondLevelCacheStatistics( REGION_NAME ).getEntries();
    assertEquals( 1, cacheMap.size() );
View Full Code Here

    Session s = openSession();
    s.beginTransaction();
    CacheableItem item = new CacheableItem( "data" );
    s.save( item );
    s.flush();
    s.refresh( item );
    s.getTransaction().rollback();
    s.close();

    Map cacheMap = getSessions().getStatistics().getSecondLevelCacheStatistics( REGION_NAME ).getEntries();
    assertEquals( 0, cacheMap.size() );
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.