FileDocCategorySizeDatePackage
RowIdTest.javaAPI DocHibernate 3.2.52498Wed Mar 28 11:03:18 BST 2007org.hibernate.test.rowid

RowIdTest

public class RowIdTest extends org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase
author
Gavin King

Fields Summary
Constructors Summary
public RowIdTest(String str)

		super(str);
	
Methods Summary
public voidafterSessionFactoryBuilt(org.hibernate.engine.SessionFactoryImplementor sfi)

		super.afterSessionFactoryBuilt( sfi );
		Session session = null;
		try {
			session = sfi.openSession();
			Statement st = session.connection().createStatement();
			try {
				st.execute( "drop table Point");
			}
			catch( Throwable ignore ) {
				// ignore
			}
			st.execute("create table Point (\"x\" number(19,2) not null, \"y\" number(19,2) not null, description varchar2(255) )");
		}
		catch ( SQLException e ) {
			throw new RuntimeException( "Unable to build actual schema : " + e.getMessage() );
		}
		finally {
			if ( session != null ) {
				try {
					session.close();
				}
				catch( Throwable ignore ) {
					// ignore
				}
			}
		}
	
public booleanappliesTo(org.hibernate.dialect.Dialect dialect)

		return dialect instanceof Oracle9Dialect;
	
public booleancreateSchema()

		return false;
	
public java.lang.StringgetCacheConcurrencyStrategy()

		return null;
	
public java.lang.String[]getMappings()

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

		return new FunctionalTestClassTestSuite( RowIdTest.class );
	
public voidtestRowId()

		Session s = openSession();
		Transaction t = s.beginTransaction();
		Point p = new Point( new BigDecimal(1.0), new BigDecimal(1.0) );
		s.persist(p);
		t.commit();
		s.clear();
		
		t = s.beginTransaction();
		p = (Point) s.createCriteria(Point.class).uniqueResult();
		p.setDescription("new desc");
		t.commit();
		s.clear();
		
		t = s.beginTransaction();
		p = (Point) s.createQuery("from Point").uniqueResult();
		p.setDescription("new new desc");
		t.commit();
		s.clear();
		
		t = s.beginTransaction();
		p = (Point) s.get(Point.class, p);
		p.setDescription("new new new desc");
		t.commit();
		s.close();