1 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 12 public class DuplicateTest extends TestCase { 13 public void testDuplicateEntityName() throws Exception { 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 } 24 } 25 } 26 | Popular Tags |