當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。