testutil.java

来自「网上拍卖系统」· Java 代码 · 共 34 行

JAVA
34
字号
package auction.test;import auction.persistence.HibernateUtil;import org.hibernate.cfg.*;import org.hibernate.tool.hbm2ddl.SchemaExport;/** * Some helper methods useful during testing. * * @author Christian Bauer */public class TestUtil {    public static String getSessionContextConfigurationSetting() {        return HibernateUtil.getConfiguration()                             .getProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS);    }    public static void enableSessionContext(String currentSessionContextClassName) {        HibernateUtil.getConfiguration()                        .setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS,                                     currentSessionContextClassName                        );        HibernateUtil.rebuildSessionFactory();    }    public static void recreateDatabase(Configuration cfg) {        SchemaExport schemaExport = new SchemaExport(cfg);        schemaExport.drop(false, true);        schemaExport.create(false, true);    }}

⌨️ 快捷键说明

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