當前位置: 首頁>>代碼示例>>Java>>正文


Java SessionFactoryImplementor.getDialect方法代碼示例

本文整理匯總了Java中org.hibernate.engine.spi.SessionFactoryImplementor.getDialect方法的典型用法代碼示例。如果您正苦於以下問題:Java SessionFactoryImplementor.getDialect方法的具體用法?Java SessionFactoryImplementor.getDialect怎麽用?Java SessionFactoryImplementor.getDialect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.engine.spi.SessionFactoryImplementor的用法示例。


在下文中一共展示了SessionFactoryImplementor.getDialect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateLockString

import org.hibernate.engine.spi.SessionFactoryImplementor; //導入方法依賴的package包/類
protected String generateLockString() {
	final SessionFactoryImplementor factory = lockable.getFactory();
	final Update update = new Update( factory.getDialect() );
	update.setTableName( lockable.getRootTableName() );
	update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
	update.setVersionColumnName( lockable.getVersionColumnName() );
	update.addColumn( lockable.getVersionColumnName() );
	if ( factory.getSettings().isCommentsEnabled() ) {
		update.setComment( lockMode + " lock " + lockable.getEntityName() );
	}
	return update.toStatementString();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:UpdateLockingStrategy.java

示例2: addBitwiseOperationsToDialect

import org.hibernate.engine.spi.SessionFactoryImplementor; //導入方法依賴的package包/類
public static void addBitwiseOperationsToDialect() {
	SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor)new _RootDAO().getSession().getSessionFactory();
	Dialect dialect = hibSessionFactory.getDialect();
	if (!dialect.getFunctions().containsKey("bit_and")) {
		if (isOracle())
			dialect.getFunctions().put("bit_and", new StandardSQLFunction("bitand", IntegerType.INSTANCE));  
		else
			dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 & ?2"));
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:HibernateUtil.java

示例3: DeleteExecutor

import org.hibernate.engine.spi.SessionFactoryImplementor; //導入方法依賴的package包/類
public DeleteExecutor(HqlSqlWalker walker, Queryable persister) {
	super( walker, persister );
	
	final SessionFactoryImplementor factory = walker.getSessionFactoryHelper().getFactory();
	final Dialect dialect = factory.getDialect();
	
	try {
		final DeleteStatement deleteStatement = (DeleteStatement) walker.getAST();
		
		final String idSubselectWhere;
		if ( deleteStatement.hasWhereClause() ) {
			final AST whereClause = deleteStatement.getWhereClause();
			final SqlGenerator gen = new SqlGenerator( factory );
			gen.whereClause( whereClause );
			parameterSpecifications = gen.getCollectedParameters();
			idSubselectWhere = gen.getSQL().length() > 7 ? gen.getSQL() : "";
		}
		else {
			parameterSpecifications = new ArrayList<ParameterSpecification>();
			idSubselectWhere = "";
		}
		
		// If many-to-many, delete the FK row in the collection table.
		for ( Type type : persister.getPropertyTypes() ) {
			if ( type.isCollectionType() ) {
				final CollectionType cType = (CollectionType) type;
				final AbstractCollectionPersister cPersister = (AbstractCollectionPersister) factory
						.getCollectionPersister( cType.getRole() );
				if ( cPersister.isManyToMany() ) {
					if ( persister.getIdentifierColumnNames().length > 1
							&& !dialect.supportsTuplesInSubqueries() ) {
						LOG.warn(
								"This dialect is unable to cascade the delete into the many-to-many join table" +
								" when the entity has multiple primary keys.  Either properly setup cascading on" +
								" the constraints or manually clear the associations prior to deleting the entities."
						);
					}
					else {
						final String idSubselect = "(select "
								+ StringHelper.join( ", ", persister.getIdentifierColumnNames() ) + " from "
								+ persister.getTableName() + idSubselectWhere + ")";
						final String where = "(" + StringHelper.join( ", ", cPersister.getKeyColumnNames() )
								+ ") in " + idSubselect;
						final Delete delete = new Delete().setTableName( cPersister.getTableName() ).setWhere( where );
						if ( factory.getSettings().isCommentsEnabled() ) {
							delete.setComment( "delete FKs in join table" );
						}
						deletes.add( delete.toStatementString() );
					}
				}
			}
		}
	}
	catch (RecognitionException e) {
		throw new HibernateException( "Unable to delete the FKs in the join table!", e );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:58,代碼來源:DeleteExecutor.java


注:本文中的org.hibernate.engine.spi.SessionFactoryImplementor.getDialect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。