duplicatetest.java

来自「hibernate3.2.6源码和jar包」· Java 代码 · 共 29 行

JAVA
29
字号
//$Id: DuplicateTest.java 11282 2007-03-14 22:05:59Z epbernard $package org.hibernate.test.annotations.duplicatedgenerator;import junit.framework.TestCase;import org.hibernate.AnnotationException;import org.hibernate.cfg.AnnotationConfiguration;import org.hibernate.cfg.Environment;/** * @author Emmanuel Bernard */public class DuplicateTest extends TestCase {	public void testDuplicateEntityName() throws Exception {		AnnotationConfiguration cfg = new AnnotationConfiguration();		cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );		try {			cfg.addAnnotatedClass( Flight.class );			cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );			cfg.addResource( "org/hibernate/test/annotations/orm.xml");			cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml");			cfg.buildSessionFactory();			fail( "Should not be able to map the same entity name twice" );		}		catch (AnnotationException ae) {			//success		}	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?