1 package org.hibernate.test.annotations; 3 4 import org.hibernate.AnnotationException; 5 import org.hibernate.SessionFactory; 6 import org.hibernate.cfg.AnnotationConfiguration; 7 import org.hibernate.cfg.Environment; 8 9 12 public class SafeMappingTest extends junit.framework.TestCase { 13 public void testDeclarativeMix() throws Exception { 14 AnnotationConfiguration cfg = new AnnotationConfiguration(); 15 cfg.addAnnotatedClass(IncorrectEntity.class); 16 cfg.setProperty(Environment.HBM2DDL_AUTO, "create-drop"); 17 try { 18 SessionFactory sf = cfg.buildSessionFactory(); 19 fail("Entity wo id should fail"); 20 } catch (AnnotationException e) { 21 } 23 } 24 } 25 | Popular Tags |