Package org.hibernate.test.annotations

Examples of org.hibernate.test.annotations.Passport


    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Customer c = new Customer();
    c.setName( "Hibernatus" );
    Passport p = new Passport();
    p.setNumber( "123456789" );
    s.persist( c ); //we need the id to assigned it to passport
    c.setPassport( p );
    p.setOwner( c );
    p.setId( c.getId() );
    tx.commit();
    s.close();
    s = openSession();
    tx = s.beginTransaction();
    c = ( Customer ) s.get( Customer.class, c.getId() );
    assertNotNull( c );
    p = c.getPassport();
    assertNotNull( p );
    assertEquals( "123456789", p.getNumber() );
    assertNotNull( p.getOwner() );
    assertEquals( "Hibernatus", p.getOwner().getName() );
    tx.commit(); // commit or rollback is the same, we don't care for read queries
    s.close();
  }
View Full Code Here


    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Customer c = new Customer();
    c.setName( "Hibernatus" );
    Passport p = new Passport();
    p.setNumber( "123456789" );
    s.persist( c ); //we need the id to assigned it to passport
    c.setPassport( p );
    p.setOwner( c );
    p.setId( c.getId() );
    tx.commit();
    s.close();
    s = openSession();
    tx = s.beginTransaction();
    c = (Customer) s.get( Customer.class, c.getId() );
    assertNotNull( c );
    p = c.getPassport();
    assertNotNull( p );
    assertEquals( "123456789", p.getNumber() );
    assertNotNull( p.getOwner() );
    assertEquals( "Hibernatus", p.getOwner().getName() );
    tx.commit(); // commit or rollback is the same, we don't care for read queries
    s.close();
  }
View Full Code Here

    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Customer c = new Customer();
    c.setName( "Hibernatus" );
    Passport p = new Passport();
    p.setNumber( "123456789" );
    s.persist( c ); //we need the id to assigned it to passport
    c.setPassport( p );
    p.setOwner( c );
    p.setId( c.getId() );
    tx.commit();
    s.close();
    s = openSession();
    tx = s.beginTransaction();
    c = (Customer) s.get( Customer.class, c.getId() );
    assertNotNull( c );
    p = c.getPassport();
    assertNotNull( p );
    assertEquals( "123456789", p.getNumber() );
    assertNotNull( p.getOwner() );
    assertEquals( "Hibernatus", p.getOwner().getName() );
    tx.commit(); // commit or rollback is the same, we don't care for read queries
    s.close();
  }
View Full Code Here

    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Customer c = new Customer();
    c.setName( "Hibernatus" );
    Passport p = new Passport();
    p.setNumber( "123456789" );
    s.persist( c ); //we need the id to assigned it to passport
    c.setPassport( p );
    p.setOwner( c );
    p.setId( c.getId() );
    tx.commit();
    s.close();
    s = openSession();
    tx = s.beginTransaction();
    c = (Customer) s.get( Customer.class, c.getId() );
    assertNotNull( c );
    p = c.getPassport();
    assertNotNull( p );
    assertEquals( "123456789", p.getNumber() );
    assertNotNull( p.getOwner() );
    assertEquals( "Hibernatus", p.getOwner().getName() );
    tx.commit(); // commit or rollback is the same, we don't care for read queries
    s.close();
  }
View Full Code Here

    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Customer c = new Customer();
    c.setName( "Hibernatus" );
    Passport p = new Passport();
    p.setNumber( "123456789" );
    s.persist( c ); //we need the id to assigned it to passport
    c.setPassport( p );
    p.setOwner( c );
    p.setId( c.getId() );
    tx.commit();
    s.close();
    s = openSession();
    tx = s.beginTransaction();
    c = (Customer) s.get( Customer.class, c.getId() );
    assertNotNull( c );
    p = c.getPassport();
    assertNotNull( p );
    assertEquals( "123456789", p.getNumber() );
    assertNotNull( p.getOwner() );
    assertEquals( "Hibernatus", p.getOwner().getName() );
    tx.commit(); // commit or rollback is the same, we don't care for read queries
    s.close();
  }
View Full Code Here

TOP

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

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.