Code example for Column

Methods: isNullable

0
 
	@Test
	public void testApplyOnManyToOne() throws Exception {
		PersistentClass classMapping = configuration().getClassMapping( TvOwner.class.getName() );
		Column serialColumn = (Column) classMapping.getProperty( "tv" ).getColumnIterator().next();
		assertEquals( "Validator annotations not applied on associations", false, serialColumn.isNullable() );
	} 
 
	@Test
	public void testSingleTableAvoidNotNull() throws Exception {
		PersistentClass classMapping = configuration().getClassMapping( Rock.class.getName() );
		Column serialColumn = (Column) classMapping.getProperty( "bit" ).getColumnIterator().next();
		assertTrue( "Notnull should not be applied on single tables", serialColumn.isNullable() );
	} 
 
	@Test
	public void testNotNullOnlyAppliedIfEmbeddedIsNotNullItself() throws Exception {
		PersistentClass classMapping = configuration().getClassMapping( Tv.class.getName() );
		Property property = classMapping.getProperty( "tuner.frequency" );
		Column serialColumn = (Column) property.getColumnIterator().next();
Experience pair programming with AI  Get Codota for Java