FileDocCategorySizeDatePackage
SequenceIdentityTest.javaAPI DocHibernate 3.2.51590Tue Dec 12 16:22:26 GMT 2006org.hibernate.test.generatedkeys.seqidentity

SequenceIdentityTest

public class SequenceIdentityTest extends org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase
author
Steve Ebersole

Fields Summary
Constructors Summary
public SequenceIdentityTest(String x)

		super( x );
	
Methods Summary
public booleanappliesTo(org.hibernate.dialect.Dialect dialect)

		// the DataDirect driver for Oracle known to not support
		// JDBC3 getGeneratedKeys...
		return ( dialect instanceof Oracle9Dialect ) && ( ! ( dialect instanceof DataDirectOracle9Dialect ) ) ;
	
public voidconfigure(org.hibernate.cfg.Configuration cfg)

		super.configure( cfg );
	
public java.lang.String[]getMappings()

		return new String[] { "generatedkeys/seqidentity/MyEntity.hbm.xml" };
	
public static junit.framework.Testsuite()

		return new FunctionalTestClassTestSuite( SequenceIdentityTest.class );
	
public voidtestSequenceIdentityGenerator()

		Session session = openSession();
		session.beginTransaction();

		MyEntity e = new MyEntity( "entity-1" );
		session.save( e );

		// this insert should happen immediately!
		assertEquals( "id not generated through forced insertion", new Long(1), e.getId() );

		session.delete( e );
		session.getTransaction().commit();
		session.close();