KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > SafeMappingTest


1 //$Id: SafeMappingTest.java,v 1.1 2005/06/09 18:34:52 epbernard Exp $
2
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 /**
10  * @author Emmanuel Bernard
11  */

12 public class SafeMappingTest extends junit.framework.TestCase {
13     public void testDeclarativeMix() throws Exception JavaDoc {
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             //success
22
}
23     }
24 }
25
Popular Tags