From: <epb...@us...> - 2006-02-11 02:51:10
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/validator/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11100/metadata/src/test/org/hibernate/validator/test Modified Files: HibernateAnnotationIntegrationTest.java Added Files: Music.java Rock.java Log Message: ANN-146 ignore SingleTable in not null --- NEW FILE: Music.java --- //$Id: Music.java,v 1.1 2006/02/11 02:50:57 epbernard Exp $ package org.hibernate.validator.test; import javax.persistence.Entity; import javax.persistence.Id; /** * @author Emmanuel Bernard */ @Entity public class Music { @Id public String name; } --- NEW FILE: Rock.java --- //$Id: Rock.java,v 1.1 2006/02/11 02:50:57 epbernard Exp $ package org.hibernate.validator.test; import javax.persistence.Entity; import org.hibernate.validator.NotNull; /** * @author Emmanuel Bernard */ @Entity public class Rock extends Music { @NotNull public Integer bit; } Index: HibernateAnnotationIntegrationTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/validator/test/HibernateAnnotationIntegrationTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- HibernateAnnotationIntegrationTest.java 10 Feb 2006 16:32:56 -0000 1.10 +++ HibernateAnnotationIntegrationTest.java 11 Feb 2006 02:50:57 -0000 1.11 @@ -42,6 +42,12 @@ assertEquals( "Validator annotations not applied on associations", false, serialColumn.isNullable() ); } + public void testSingleTableAvoidNotNull() throws Exception { + PersistentClass classMapping = getCfg().getClassMapping( Rock.class.getName() ); + Column serialColumn = (Column) classMapping.getProperty("bit").getColumnIterator().next(); + assertTrue( "Notnull should not be applised on single tables", serialColumn.isNullable() ); + } + public void testEvents() throws Exception { Session s; Transaction tx; @@ -151,7 +157,9 @@ Martian.class, Venusian.class, Tv.class, - TvOwner.class + TvOwner.class, + Music.class, + Rock.class }; } |