legacytestcase.java
来自「好东西,hibernate-3.2.0,他是一开元的树杖hibernate-3.」· Java 代码 · 共 46 行
JAVA
46 行
package org.hibernate.test.legacy;
import org.hibernate.test.TestCase;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.hql.classic.ClassicQueryTranslatorFactory;
import org.hibernate.util.StringHelper;
/**
* @author Steve Ebersole
*/
public abstract class LegacyTestCase extends TestCase {
public static final String USE_ANTLR_PARSER_PROP = "legacy.use_antlr_hql_parser";
private final boolean useAntlrParser;
public LegacyTestCase(String x) {
super( x );
useAntlrParser = Boolean.valueOf( extractFromSystem( USE_ANTLR_PARSER_PROP ) ).booleanValue();
}
protected static String extractFromSystem(String systemPropertyName) {
try {
return System.getProperty( systemPropertyName );
}
catch( Throwable t ) {
return null;
}
}
protected void configure(Configuration cfg) {
super.configure( cfg );
if ( !useAntlrParser ) {
cfg.setProperty( Environment.QUERY_TRANSLATOR, ClassicQueryTranslatorFactory.class.getName() );
String subs = cfg.getProperties().getProperty( Environment.QUERY_SUBSTITUTIONS );
if ( StringHelper.isEmpty( subs ) ) {
subs = "true=1, false=0";
}
else {
subs += ", true=1, false=0";
}
cfg.getProperties().setProperty( Environment.QUERY_SUBSTITUTIONS, subs );
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?