当前位置: 首页>>代码示例>>Java>>正文


Java ASTQueryTranslatorFactory类代码示例

本文整理汇总了Java中org.hibernate.hql.ast.ASTQueryTranslatorFactory的典型用法代码示例。如果您正苦于以下问题:Java ASTQueryTranslatorFactory类的具体用法?Java ASTQueryTranslatorFactory怎么用?Java ASTQueryTranslatorFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ASTQueryTranslatorFactory类属于org.hibernate.hql.ast包,在下文中一共展示了ASTQueryTranslatorFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hqlToSql

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
private static String hqlToSql(String hqlQueryText, SessionFactory sessionFactory) {
	if (hqlQueryText != null && hqlQueryText.trim().length() > 0
			&& sessionFactory != null) {
		final QueryTranslatorFactory translatorFactory = new ASTQueryTranslatorFactory();
		final SessionFactoryImplementor factory = (SessionFactoryImplementor) sessionFactory;
		final QueryTranslator translator = translatorFactory
				.createQueryTranslator(hqlQueryText, hqlQueryText,
						Collections.EMPTY_MAP, factory);
		translator.compile(Collections.EMPTY_MAP, false);
		return translator.getSQLString();
	}
	return null;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:14,代码来源:QueryUtil.java

示例2: toSql

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
/**
 * HQL to SQL translator
 */
public static String toSql(String hql) {
	if (hql != null && hql.trim().length() > 0) {
		final QueryTranslatorFactory qtf = new ASTQueryTranslatorFactory();
		final SessionFactoryImplementor sfi = (SessionFactoryImplementor) sessionFactory;
		final QueryTranslator translator = qtf.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, sfi);
		translator.compile(Collections.EMPTY_MAP, false);
		return translator.getSQLString();
	}

	return null;
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:15,代码来源:HibernateUtil.java

示例3: assertEjbqlEqualsHql

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
private void assertEjbqlEqualsHql(String ejbql, String hql) {
	QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();

	QueryTranslator queryTranslator = ast.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, sfi() );
	queryTranslator.compile( Collections.EMPTY_MAP, true );
	String hqlSql = queryTranslator.getSQLString();

	queryTranslator = ast.createQueryTranslator( ejbql, ejbql, Collections.EMPTY_MAP, sfi() );
	queryTranslator.compile( Collections.EMPTY_MAP, true );
	String ejbqlSql = queryTranslator.getSQLString();

	assertEquals( hqlSql, ejbqlSql );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:EJBQLTest.java

示例4: compile

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
private QueryTranslatorImpl compile(String input) {
	QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
	QueryTranslator queryTranslator = ast.createQueryTranslator( input, input, Collections.EMPTY_MAP, sfi() );
	queryTranslator.compile( Collections.EMPTY_MAP, true );

	return ( QueryTranslatorImpl ) queryTranslator;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:EJBQLTest.java

示例5: compileWithAstQueryTranslator

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
private void compileWithAstQueryTranslator(String hql, boolean scalar) {
	Map replacements = new HashMap();
	QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
	SessionFactoryImplementor factory = getSessionFactoryImplementor();
	QueryTranslator newQueryTranslator = ast.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, factory );
	newQueryTranslator.compile( replacements, scalar );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:HQLTest.java

示例6: createNewQueryTranslator

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
private QueryTranslatorImpl createNewQueryTranslator(String hql, Map replacements, boolean scalar, SessionFactoryImplementor factory) {
	QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
	QueryTranslatorImpl newQueryTranslator = ( QueryTranslatorImpl ) ast.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, factory );
	newQueryTranslator.compile( replacements, scalar );
	return newQueryTranslator;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:7,代码来源:QueryTranslatorTestCase.java

示例7: toSql

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
private String toSql(String hql) {
	QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
	QueryTranslator queryTranslator = ast.createQueryTranslator( hql, hql, Collections.EMPTY_MAP, sfi() );
	queryTranslator.compile( Collections.EMPTY_MAP, true );
	return queryTranslator.getSQLString();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:7,代码来源:EJBQLTest.java

示例8: configure

import org.hibernate.hql.ast.ASTQueryTranslatorFactory; //导入依赖的package包/类
public void configure(Configuration cfg) {
	super.configure( cfg );
	cfg.setProperty( Environment.USE_QUERY_CACHE, "true" );
	cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
	cfg.setProperty( Environment.QUERY_TRANSLATOR, ASTQueryTranslatorFactory.class.getName() );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:7,代码来源:ASTParserLoadingTest.java


注:本文中的org.hibernate.hql.ast.ASTQueryTranslatorFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。