Package org.hibernate.test.instrument.domain

Examples of org.hibernate.test.instrument.domain.Problematic


  }

  public void execute() {
    Session s = getFactory().openSession();
    s.beginTransaction();
    Problematic p = new Problematic();
    p.setName( "whatever" );
    p.setBytes( new byte[] { 1, 0, 1, 1, 0 } );
    s.save( p );
    s.getTransaction().commit();
    s.close();

    // this access should be ok because p1 is not a lazy proxy
    s = getFactory().openSession();
    s.beginTransaction();
    Problematic p1 = (Problematic) s.get( Problematic.class, p.getId() );
    Assert.assertTrue( FieldInterceptionHelper.isInstrumented( p1 ) );
    p1.getRepresentation();
    s.getTransaction().commit();
    s.close();
   
    s = getFactory().openSession();
    s.beginTransaction();
    p1 = (Problematic) s.createQuery( "from Problematic" ).setReadOnly(true ).list().get( 0 );
    p1.getRepresentation();
    s.getTransaction().commit();
    s.close();
   
    s = getFactory().openSession();
    s.beginTransaction();
    p1 = (Problematic) s.load( Problematic.class, p.getId() );
    Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
    p1.setRepresentation( p.getRepresentation() );
    s.getTransaction().commit();
    s.close();
  }
View Full Code Here


  protected void cleanup() {
    Session s = getFactory().openSession();
    s.beginTransaction();
    Iterator itr = s.createQuery( "from Problematic" ).list().iterator();
    while ( itr.hasNext() ) {
      Problematic p = (Problematic) itr.next();
      s.delete( p );
    }
    s.getTransaction().commit();
    s.close();
  }
View Full Code Here

    return new String[] { "org/hibernate/test/instrument/domain/Problematic.hbm.xml" };
  }

  public void execute() throws Exception {
    Session s = getFactory().openSession();
    Problematic p = new Problematic();
    try {
      s.beginTransaction();
      p.setName( "whatever" );
      p.setBytes( new byte[] { 1, 0, 1, 1, 0 } );
      s.save( p );
      s.getTransaction().commit();
    } catch (Exception e) {
      s.getTransaction().rollback();
      throw e;
    } finally {
      s.close();
    }

    // this access should be ok because p1 is not a lazy proxy
    s = getFactory().openSession();
    try {
      s.beginTransaction();
      Problematic p1 = (Problematic) s.get( Problematic.class, p.getId() );
      Assert.assertTrue( FieldInterceptionHelper.isInstrumented( p1 ) );
      p1.getRepresentation();
      s.getTransaction().commit();
    } catch (Exception e) {
      s.getTransaction().rollback();
      throw e;
    } finally {
      s.close();
    }
   
    s = getFactory().openSession();
    try {
      s.beginTransaction();
      Problematic p1 = (Problematic) s.createQuery( "from Problematic" ).setReadOnly(true ).list().get( 0 );
      p1.getRepresentation();
      s.getTransaction().commit();
    } catch (Exception e) {
      s.getTransaction().rollback();
      throw e;
    } finally {
      s.close();
    }
   
    s = getFactory().openSession();
    try {
      s.beginTransaction();
      Problematic p1 = (Problematic) s.load( Problematic.class, p.getId() );
      Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
      p1.setRepresentation( p.getRepresentation() );
      s.getTransaction().commit();
    } catch (Exception e) {
      s.getTransaction().rollback();
      throw e;
    } finally {
View Full Code Here

  protected void cleanup() {
    Session s = getFactory().openSession();
    s.beginTransaction();
    Iterator itr = s.createQuery( "from Problematic" ).list().iterator();
    while ( itr.hasNext() ) {
      Problematic p = (Problematic) itr.next();
      s.delete( p );
    }
    s.getTransaction().commit();
    s.close();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.test.instrument.domain.Problematic

Copyright © 2018 www.massapicom. 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.