📄 testcase.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -