Package org.hibernate.test.annotations.id.sequences.entities

Examples of org.hibernate.test.annotations.id.sequences.entities.Computer


    Session s = openSession();
    Transaction tx = s.beginTransaction();

    Ball b = new Ball();
    Dog d = new Dog();
    Computer c = new Computer();
    s.persist( b );
    s.persist( d );
    s.persist( c );
    tx.commit();
    s.close();
    assertEquals( "table id not generated", new Integer( 1 ), b.getId() );
    assertEquals(
        "generator should not be shared", new Integer( 1 ), d
            .getId()
    );
    assertEquals( "default value should work", new Long( 1 ), c.getId() );

    s = openSession();
    tx = s.beginTransaction();
    s.delete( s.get( Ball.class, new Integer( 1 ) ) );
    s.delete( s.get( Dog.class, new Integer( 1 ) ) );
View Full Code Here


    Session s = openSession();
    Transaction tx = s.beginTransaction();

    Ball b = new Ball();
    Dog d = new Dog();
    Computer c = new Computer();
    s.persist(b);
    s.persist(d);
    s.persist(c);
    tx.commit();
    s.close();
    assertEquals("table id not generated", new Integer(1), b.getId());
    assertEquals("generator should not be shared", new Integer(1), d
        .getId());
    assertEquals("default value should work", new Long(1), c.getId());

    s = openSession();
    tx = s.beginTransaction();
    s.delete(s.get(Ball.class, new Integer(1)));
    s.delete(s.get(Dog.class, new Integer(1)));
View Full Code Here

    Session s = openSession();
    Transaction tx = s.beginTransaction();

    Ball b = new Ball();
    Dog d = new Dog();
    Computer c = new Computer();
    s.persist(b);
    s.persist(d);
    s.persist(c);
    tx.commit();
    s.close();
    assertEquals("table id not generated", new Integer(1), b.getId());
    assertEquals("generator should not be shared", new Integer(1), d
        .getId());
    assertEquals("default value should work", new Long(1), c.getId());

    s = openSession();
    tx = s.beginTransaction();
    s.delete(s.get(Ball.class, new Integer(1)));
    s.delete(s.get(Dog.class, new Integer(1)));
View Full Code Here

TOP

Related Classes of org.hibernate.test.annotations.id.sequences.entities.Computer

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.