duplicatetest.java

来自「hibernate方便的操作数据库相当不错的 请各位下载看看啊」· Java 代码 · 共 25 行

JAVA
25
字号
//$Id: DuplicateTest.java,v 1.1 2004/12/24 15:07:25 epbernard Exp $package org.hibernate.test.metadata.duplicatedgenerator;import org.hibernate.cfg.AnnotationConfiguration;import org.hibernate.cfg.Environment;import org.hibernate.AnnotationException;import junit.framework.TestCase;/** * @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.metadata.Flight.class);			fail("Should not be able to map the same entity name twice");		} catch (AnnotationException ae) {			//success		}	}}

⌨️ 快捷键说明

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