当前位置: 首页>>代码示例>>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;未经允许,请勿转载。