FileDocCategorySizeDatePackage
AbstractGeneratedPropertyTest.javaAPI DocHibernate 3.2.51379Tue Dec 12 16:22:26 GMT 2006org.hibernate.test.generated

AbstractGeneratedPropertyTest

public abstract class AbstractGeneratedPropertyTest extends org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase
Implementation of AbstractGeneratedPropertyTest.
author
Steve Ebersole

Fields Summary
Constructors Summary
public AbstractGeneratedPropertyTest(String x)

		super( x );
	
Methods Summary
public final voidtestGeneratedProperty()

		GeneratedPropertyEntity entity = new GeneratedPropertyEntity();
		entity.setName( "entity-1" );
		Session s = openSession();
		Transaction t = s.beginTransaction();
		s.save( entity );
		s.flush();
		assertNotNull( "no timestamp retrieved", entity.getLastModified() );
		t.commit();
		s.close();

		byte[] bytes = entity.getLastModified();

		s = openSession();
		t = s.beginTransaction();
		entity = ( GeneratedPropertyEntity ) s.get( GeneratedPropertyEntity.class, entity.getId() );
		assertTrue( Hibernate.BINARY.isEqual( bytes, entity.getLastModified() ) );
		t.commit();
		s.close();

		assertTrue( Hibernate.BINARY.isEqual( bytes, entity.getLastModified() ) );

		s = openSession();
		t = s.beginTransaction();
		s.delete( entity );
		t.commit();
		s.close();