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


Java SessionFactoryImplementor类代码示例

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


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

示例1: render

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public String render(Type firstArgumentType, List arguments, SessionFactoryImplementor sessionFactory) {
	final boolean hasArgs = !arguments.isEmpty();
	final StringBuilder buf = new StringBuilder( getName() );
	if ( hasArgs ) {
		buf.append( "(" );
		for ( int i = 0; i < arguments.size(); i++ ) {
			buf.append( arguments.get( i ) );
			if ( i < arguments.size() - 1 ) {
				buf.append( ", " );
			}
		}
		buf.append( ")" );
	}
	return buf.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:ConditionalParenthesisFunction.java

示例2: getNumberOfAssociations

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public long getNumberOfAssociations(SessionFactory sessionFactory) {
	int associationCount = 0;
	IgniteDatastoreProvider datastoreProvider = getProvider( sessionFactory );
	for ( CollectionPersister collectionPersister : ( (SessionFactoryImplementor) sessionFactory ).getCollectionPersisters().values() ) {
		AssociationKeyMetadata associationKeyMetadata = ( (OgmCollectionPersister) collectionPersister ).getAssociationKeyMetadata();
		if ( associationKeyMetadata.getAssociationKind() == AssociationKind.ASSOCIATION ) {
			IgniteCache<Object, BinaryObject> associationCache = getAssociationCache( sessionFactory, associationKeyMetadata );
			StringBuilder query = new StringBuilder( "SELECT " )
										.append( StringHelper.realColumnName( associationKeyMetadata.getColumnNames()[0] ) )
										.append( " FROM " ).append( associationKeyMetadata.getTable() );
			SqlFieldsQuery sqlQuery = datastoreProvider.createSqlFieldsQueryWithLog( query.toString(), null );
			Iterable<List<?>> queryResult = associationCache.query( sqlQuery );
			Set<Object> uniqs = new HashSet<>();
			for ( List<?> row : queryResult ) {
				Object value = row.get( 0 );
				if ( value != null ) {
					uniqs.add( value );
				}
			}
			associationCount += uniqs.size();
		}
	}
	return associationCount;
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:26,代码来源:IgniteTestHelper.java

示例3: addAssociationsToTheSetForOneProperty

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
private void addAssociationsToTheSetForOneProperty(String name, Type type, String prefix, SessionFactoryImplementor factory) {

		if ( type.isCollectionType() ) {
			CollectionType collType = (CollectionType) type;
			Type assocType = collType.getElementType( factory );
			addAssociationsToTheSetForOneProperty(name, assocType, prefix, factory);
		}
		//ToOne association
		else if ( type.isEntityType() || type.isAnyType() ) {
			associations.add( prefix + name );
		} else if ( type.isComponentType() ) {
			CompositeType componentType = (CompositeType) type;
			addAssociationsToTheSetForAllProperties(
					componentType.getPropertyNames(),
					componentType.getSubtypes(),
					(prefix.equals( "" ) ? name : prefix + name) + ".",
					factory);
		}
	}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:HibernateTraversableResolver.java

示例4: getAssociatedEntityName

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public String getAssociatedEntityName(SessionFactoryImplementor factory)
		throws MappingException {
	try {
		
		QueryableCollection collectionPersister = (QueryableCollection) factory
				.getCollectionPersister( role );
		
		if ( !collectionPersister.getElementType().isEntityType() ) {
			throw new MappingException( 
					"collection was not an association: " + 
					collectionPersister.getRole() 
				);
		}
		
		return collectionPersister.getElementPersister().getEntityName();
		
	}
	catch (ClassCastException cce) {
		throw new MappingException( "collection role is not queryable " + role );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:CollectionType.java

示例5: toLoggableString

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public String toLoggableString(Object value, SessionFactoryImplementor factory)
		throws HibernateException {
	if ( value == null ) {
		return "null";
	}

	if ( entityMode == null ) {
		throw new ClassCastException( value.getClass().getName() );
	}
	Map<String,String> result = new HashMap<String, String>();
	Object[] values = getPropertyValues( value, entityMode );
	for ( int i = 0; i < propertyTypes.length; i++ ) {
		result.put( propertyNames[i], propertyTypes[i].toLoggableString( values[i], factory ) );
	}
	return StringHelper.unqualify( getName() ) + result.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ComponentType.java

示例6: toSqlString

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public final String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
	final String entityName = criteriaQuery.getEntityName( criteria, propertyName );
	final String actualPropertyName = criteriaQuery.getPropertyName( propertyName );
	final String sqlAlias = criteriaQuery.getSQLAlias( criteria, propertyName );

	final SessionFactoryImplementor factory = criteriaQuery.getFactory();
	final QueryableCollection collectionPersister = getQueryableCollection( entityName, actualPropertyName, factory );

	final String[] collectionKeys = collectionPersister.getKeyColumnNames();
	final String[] ownerKeys = ( (Loadable) factory.getEntityPersister( entityName ) ).getIdentifierColumnNames();

	final String innerSelect = "(select 1 from " + collectionPersister.getTableName() + " where "
			+ new ConditionFragment().setTableAlias( sqlAlias ).setCondition( ownerKeys, collectionKeys ).toFragmentString()
			+ ")";

	return excludeEmpty()
			? "exists " + innerSelect
			: "not exists " + innerSelect;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:AbstractEmptinessExpression.java

示例7: render

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public String render(Type columnType, List args, SessionFactoryImplementor factory) throws QueryException {
	if ( args.size()!=2 ) {
		throw new QueryException( "cast() requires two arguments; found : " + args.size() );
	}
	final String type = (String) args.get( 1 );
	final int[] sqlTypeCodes = factory.getTypeResolver().heuristicType( type ).sqlTypes( factory );
	if ( sqlTypeCodes.length!=1 ) {
		throw new QueryException("invalid Hibernate type for cast()");
	}
	String sqlType = factory.getDialect().getCastTypeName( sqlTypeCodes[0] );
	if ( sqlType == null ) {
		//TODO: never reached, since getExplicitHibernateTypeName() actually throws an exception!
		sqlType = type;
	}
	return "cast(" + args.get( 0 ) + " as " + sqlType + ')';
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:CastFunction.java

示例8: createAndSetInnerQuery

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
/**
 * Creates the inner query used to extract some useful information about types, since it is needed in both methods.
 *
 * @param criteriaQuery The criteria query
 * @param factory The session factory.
 */
private void createAndSetInnerQuery(CriteriaQuery criteriaQuery, SessionFactoryImplementor factory) {
	if ( innerQuery == null ) {
		//with two-deep subqueries, the same alias would get generated for
		//both using the old method (criteriaQuery.generateSQLAlias()), so
		//that is now used as a fallback if the main criteria alias isn't set
		String alias;
		if ( this.criteriaImpl.getAlias() == null ) {
			alias = criteriaQuery.generateSQLAlias();
		}
		else {
			alias = this.criteriaImpl.getAlias() + "_";
		}

		innerQuery = new CriteriaQueryTranslator(
				factory,
				criteriaImpl,
				criteriaImpl.getEntityOrClassName(),
				alias,
				criteriaQuery
			);

		params = innerQuery.getQueryParameters();
		types = innerQuery.getProjectedTypes();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:SubqueryExpression.java

示例9: associateSubclassNamesToSubclassTableIndexes

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
private void associateSubclassNamesToSubclassTableIndexes(
		PersistentClass persistentClass,
		Set<String> classNames,
		String[][] mapping,
		SessionFactoryImplementor factory) {

	final String tableName = persistentClass.getTable().getQualifiedName(
			factory.getDialect(),
			factory.getSettings().getDefaultCatalogName(),
			factory.getSettings().getDefaultSchemaName()
	);

	associateSubclassNamesToSubclassTableIndex( tableName, classNames, mapping );

	Iterator itr = persistentClass.getJoinIterator();
	while ( itr.hasNext() ) {
		final Join join = (Join) itr.next();
		final String secondaryTableName = join.getTable().getQualifiedName(
				factory.getDialect(),
				factory.getSettings().getDefaultCatalogName(),
				factory.getSettings().getDefaultSchemaName()
		);
		associateSubclassNamesToSubclassTableIndex( secondaryTableName, classNames, mapping );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:JoinedSubclassEntityPersister.java

示例10: extractEntityTuple

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public Map<String, Object> extractEntityTuple(Session session, EntityKey key) {
	SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) session.getSessionFactory();
	IgniteCache<Object, BinaryObject> cache = getEntityCache( sessionFactory, key.getMetadata() );
	Object cacheKey = getProvider( sessionFactory ).createKeyObject( key );

	Map<String, Object> result = new HashMap<>();
	BinaryObject po = cache.get( cacheKey );

	TupleSnapshot snapshot = new IgniteTupleSnapshot( cacheKey, po, key.getMetadata() );
	for ( String fieldName : snapshot.getColumnNames() ) {
		result.put( fieldName, snapshot.get( fieldName ) );
	}

	return result;
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:17,代码来源:IgniteTestHelper.java

示例11: BasicCollectionLoader

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
protected BasicCollectionLoader(
		QueryableCollection collectionPersister,
		int batchSize,
		String subquery,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	super( collectionPersister, factory, loadQueryInfluencers );

	JoinWalker walker = new BasicCollectionJoinWalker(
			collectionPersister,
			batchSize,
			subquery,
			factory,
			loadQueryInfluencers
	);
	initFromWalker( walker );

	postInstantiate();

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for collection %s: %s", collectionPersister.getRole(), getSQLString() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:BasicCollectionLoader.java

示例12: createCollectionJoin

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
public JoinDefinedByMetadata createCollectionJoin(
		QuerySpace leftHandSide,
		String lhsPropertyName,
		CollectionQuerySpace rightHandSide,
		boolean rightHandSideRequired,
		CollectionType joinedPropertyType,
		SessionFactoryImplementor sessionFactory) {
	return new JoinImpl(
			leftHandSide,
			lhsPropertyName,
			rightHandSide,
			joinedPropertyType.getAssociatedJoinable( sessionFactory ).getKeyColumnNames(),
			joinedPropertyType,
			rightHandSideRequired
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:JoinHelper.java

示例13: render

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@Override
public String render(Type firstArgumentType, List args, SessionFactoryImplementor factory) throws QueryException {
	final boolean threeArgs = args.size() > 2;
	final Object pattern = args.get( 0 );
	final Object string = args.get( 1 );
	final Object start = threeArgs ? args.get( 2 ) : null;

	final StringBuilder buf = new StringBuilder();
	if (threeArgs) {
		buf.append( '(' );
	}
	buf.append( "position(" ).append( pattern ).append( " in " );
	if (threeArgs) {
		buf.append( "substring(");
	}
	buf.append( string );
	if (threeArgs) {
		buf.append( ", " ).append( start ).append( ')' );
	}
	buf.append( ')' );
	if (threeArgs) {
		buf.append( '+' ).append( start ).append( "-1)" );
	}
	return buf.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PositionSubstringFunction.java

示例14: SessionFactoryServiceRegistryImpl

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
@SuppressWarnings( {"unchecked"})
public SessionFactoryServiceRegistryImpl(
		ServiceRegistryImplementor parent,
		SessionFactoryImplementor sessionFactory,
		MetadataImplementor metadata) {
	super( parent );

	this.sessionFactory = sessionFactory;
	this.configuration = null;
	this.metadata = metadata;

	// for now, just use the standard initiator list
	for ( SessionFactoryServiceInitiator initiator : StandardSessionFactoryServiceInitiators.LIST ) {
		// create the bindings up front to help identify to which registry services belong
		createServiceBinding( initiator );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:SessionFactoryServiceRegistryImpl.java

示例15: generateLockString

import org.hibernate.engine.spi.SessionFactoryImplementor; //导入依赖的package包/类
protected String generateLockString(int timeout) {
	final SessionFactoryImplementor factory = getLockable().getFactory();
	final LockOptions lockOptions = new LockOptions( getLockMode() );
	lockOptions.setTimeOut( timeout );
	final SimpleSelect select = new SimpleSelect( factory.getDialect() )
			.setLockOptions( lockOptions )
			.setTableName( getLockable().getRootTableName() )
			.addColumn( getLockable().getRootTableIdentifierColumnNames()[0] )
			.addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" );
	if ( getLockable().isVersioned() ) {
		select.addCondition( getLockable().getVersionColumnName(), "=?" );
	}
	if ( factory.getSettings().isCommentsEnabled() ) {
		select.setComment( getLockMode() + " lock " + getLockable().getEntityName() );
	}
	return select.toStatementString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:SelectLockingStrategy.java


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