FileDocCategorySizeDatePackage
ParameterizedUserCollectionTypeTest.javaAPI DocHibernate 3.2.51466Tue May 08 22:52:56 BST 2007org.hibernate.test.usercollection.parameterized

ParameterizedUserCollectionTypeTest

public class ParameterizedUserCollectionTypeTest extends org.hibernate.junit.functional.FunctionalTestCase
Tes for parameterized user collection types.
author
Holger Brands
author
Steve Ebersole

Fields Summary
Constructors Summary
public ParameterizedUserCollectionTypeTest(String string)

		super( string );
	
Methods Summary
public java.lang.String[]getMappings()

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

		return new FunctionalTestClassTestSuite( ParameterizedUserCollectionTypeTest.class );
	
public voidtestBasicOperation()

		Session s = openSession();
		Transaction t = s.beginTransaction();
		Entity entity = new Entity( "tester" );
		entity.getValues().add( "value-1" );
		s.persist( entity );
		t.commit();
		s.close();

		s = openSession();
		t = s.beginTransaction();
		entity = ( Entity ) s.get( Entity.class, "tester" );
		assertTrue( Hibernate.isInitialized( entity.getValues() ) );
		assertEquals( 1, entity.getValues().size() );
        assertEquals( "Hello", ( ( DefaultableList ) entity.getValues() ).getDefaultValue() );
		s.delete( entity );
		t.commit();
		s.close();