testcase.java

来自「webwork in action 下载。」· Java 代码 · 共 39 行

JAVA
39
字号
package org.hibernate.auction.test;import net.sf.hibernate.cfg.Environment;import net.sf.hibernate.tool.hbm2ddl.SchemaExport;import org.hibernate.auction.persistence.HibernateUtil;public abstract class TestCase extends junit.framework.TestCase {	public TestCase(String s) {		super(s);	}	protected void runTest() throws Throwable {		try {			System.out.println("Running test...");			super.runTest();		} catch (Throwable e) {			HibernateUtil.rollbackTransaction();			throw e;		} finally{			HibernateUtil.closeSession();		}	}	protected void setUp() throws Exception {		super.setUp();		SchemaExport ddlExport = new SchemaExport(HibernateUtil.getConfiguration());		ddlExport.create(false, true);	}	protected void tearDown() throws Exception {		super.tearDown();		SchemaExport ddlExport = new SchemaExport(HibernateUtil.getConfiguration());		ddlExport.drop(false, true);	}}

⌨️ 快捷键说明

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