Package org.hibernate.test.annotations

Examples of org.hibernate.test.annotations.Plane


  }

  public void testPolymorphism() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    p.setNbrOfSeats( 10 );
    A320 a = new A320();
    a.setJavaEmbeddedVersion( "5.0" );
    a.setNbrOfSeats( 300 );
    s.persist( a );
    s.persist( p );
View Full Code Here


  }

  public void testEmbeddedSuperclass() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    p.setAlive( true ); //sic
    p.setAltitude( 10000 );
    p.setMetricAltitude( 3000 );
    p.setNbrOfSeats( 150 );
    p.setSerial( "0123456789" );
    s.persist( p );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    p = (Plane) s.get( Plane.class, p.getId() );
    assertNotNull( p );
    assertEquals( true, p.isAlive() );
    assertEquals( 150, p.getNbrOfSeats() );
    assertEquals( 10000, p.getAltitude() );
    assertEquals( "0123456789", p.getSerial() );
    assertFalse( 3000 == p.getMetricAltitude() );
    s.delete( p );
    tx.commit();
    s.close();
  }
View Full Code Here

  }

  public void testPackageQueries() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    s.persist( p );
    Query q = s.getNamedQuery( "plane.getAll" );
    assertEquals( 1, q.list().size() );
    tx.commit();
    s.close();
View Full Code Here

  public void testCache() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Plane plane = new Plane();
    plane.setNbrOfSeats( 5 );
    s.persist( plane );
    tx.commit();
    s.close();
    getSessions().getStatistics().clear();
    getSessions().getStatistics().setStatisticsEnabled( true );
    s = openSession();
    tx = s.beginTransaction();
    Query query = s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() );
    plane = ( Plane ) query.uniqueResult();
    assertEquals( 1, getSessions().getStatistics().getQueryCachePutCount() );
    plane = ( Plane ) s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() ).uniqueResult();
    assertEquals( 1, getSessions().getStatistics().getQueryCacheHitCount() );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    s.delete( s.get( Plane.class, plane.getId() ) );
    tx.commit();
    s.close();
  }
View Full Code Here

  }

  public void testPackageQueries() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    s.persist( p );
    Query q = s.getNamedQuery( "plane.getAll" );
    assertEquals( 1, q.list().size() );
    tx.commit();
    s.close();
View Full Code Here

  public void testCache() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Plane plane = new Plane();
    plane.setNbrOfSeats( 5 );
    s.persist( plane );
    tx.commit();
    s.close();
    getSessions().getStatistics().clear();
    getSessions().getStatistics().setStatisticsEnabled( true );
    s = openSession();
    tx = s.beginTransaction();
    Query query = s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() );
    plane = (Plane) query.uniqueResult();
    assertEquals( 1, getSessions().getStatistics().getQueryCachePutCount() );
    plane = (Plane) s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() ).uniqueResult();
    assertEquals( 1, getSessions().getStatistics().getQueryCacheHitCount() );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    s.delete( s.get( Plane.class, plane.getId() ) );
    tx.commit();
    s.close();
  }
View Full Code Here

  }

  public void testPackageQueries() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    s.persist( p );
    Query q = s.getNamedQuery( "plane.getAll" );
    assertEquals( 1, q.list().size() );
    tx.commit();
    s.close();
View Full Code Here

  public void testCache() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Plane plane = new Plane();
    plane.setNbrOfSeats( 5 );
    s.persist( plane );
    tx.commit();
    s.close();
    getSessions().getStatistics().clear();
    getSessions().getStatistics().setStatisticsEnabled( true );
    s = openSession();
    tx = s.beginTransaction();
    Query query = s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() );
    plane = (Plane) query.uniqueResult();
    assertEquals( 1, getSessions().getStatistics().getQueryCachePutCount() );
    plane = (Plane) s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() ).uniqueResult();
    assertEquals( 1, getSessions().getStatistics().getQueryCacheHitCount() );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    s.delete( s.get( Plane.class, plane.getId() ) );
    tx.commit();
    s.close();
  }
View Full Code Here

  }

  public void testPolymorphism() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    p.setNbrOfSeats( 10 );
    A320 a = new A320();
    a.setJavaEmbeddedVersion( "5.0" );
    a.setNbrOfSeats( 300 );
    s.persist( a );
    s.persist( p );
View Full Code Here

  }

  public void testEmbeddedSuperclass() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Plane p = new Plane();
    p.setAlive( true ); //sic
    p.setAltitude( 10000 );
    p.setMetricAltitude( 3000 );
    p.setNbrOfSeats( 150 );
    p.setSerial( "0123456789" );
    s.persist( p );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    p = (Plane) s.get( Plane.class, p.getId() );
    assertNotNull( p );
    assertEquals( true, p.isAlive() );
    assertEquals( 150, p.getNbrOfSeats() );
    assertEquals( 10000, p.getAltitude() );
    assertEquals( "0123456789", p.getSerial() );
    assertFalse( 3000 == p.getMetricAltitude() );
    s.delete( p );
    tx.commit();
    s.close();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.test.annotations.Plane

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.