KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > duplicatedgenerator > DuplicateTest


1 //$Id: DuplicateTest.java,v 1.1 2005/05/12 13:33:27 epbernard Exp $
2
package org.hibernate.test.annotations.duplicatedgenerator;
3
4 import junit.framework.TestCase;
5 import org.hibernate.AnnotationException;
6 import org.hibernate.cfg.AnnotationConfiguration;
7 import org.hibernate.cfg.Environment;
8
9 /**
10  * @author Emmanuel Bernard
11  */

12 public class DuplicateTest extends TestCase {
13     public void testDuplicateEntityName() throws Exception JavaDoc {
14         AnnotationConfiguration cfg = new AnnotationConfiguration();
15         cfg.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
16         try {
17             cfg.addAnnotatedClass(Flight.class);
18             cfg.addAnnotatedClass(org.hibernate.test.annotations.Flight.class);
19             cfg.buildSessionFactory();
20             fail("Should not be able to map the same entity name twice");
21         } catch (AnnotationException ae) {
22             //success
23
}
24     }
25 }
26
Popular Tags