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


Java Mapping类代码示例

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


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

示例1: validate

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public void validate(Mapping mapping) throws MappingException {
	Iterator iter = getPropertyIterator();
	while ( iter.hasNext() ) {
		Property prop = (Property) iter.next();
		if ( !prop.isValid(mapping) ) {
			throw new MappingException(
					"property mapping has wrong number of columns: " +
					StringHelper.qualify( getEntityName(), prop.getName() ) +
					" type: " +
					prop.getType().getName()
				);
		}
	}
	checkPropertyDuplication();
	checkColumnDuplication();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PersistentClass.java

示例2: UnionSubclassEntityPersister

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public UnionSubclassEntityPersister(
		final EntityBinding entityBinding,
		final EntityRegionAccessStrategy cacheAccessStrategy,
		final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
		final SessionFactoryImplementor factory,
		final Mapping mapping) throws HibernateException {
	super(entityBinding, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
	// TODO: implement!!! initializing final fields to null to make compiler happy.
	subquery = null;
	tableName = null;
	subclassClosure = null;
	spaces = null;
	subclassSpaces = null;
	discriminatorValue = null;
	discriminatorSQLValue = null;
	constraintOrderedTableNames = null;
	constraintOrderedKeyColumnNames = null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:UnionSubclassEntityPersister.java

示例3: getAliasedLHSColumnNames

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
/**
 * Get the qualified (prefixed by alias) names of the columns of the owning entity which are to be used in the join
 *
 * @param associationType The association type for the association that represents the join
 * @param columnQualifier The left-hand side table alias
 * @param propertyIndex The index of the property that represents the association/join
 * @param begin The index for any nested (composites) attributes
 * @param lhsPersister The persister for the left-hand side of the association/join
 * @param mapping The mapping (typically the SessionFactory).
 *
 * @return The qualified column names.
 */
public static String[] getAliasedLHSColumnNames(
		AssociationType associationType,
		String columnQualifier,
		int propertyIndex,
		int begin,
		OuterJoinLoadable lhsPersister,
		Mapping mapping) {
	if ( associationType.useLHSPrimaryKey() ) {
		return StringHelper.qualify( columnQualifier, lhsPersister.getIdentifierColumnNames() );
	}
	else {
		final String propertyName = associationType.getLHSPropertyName();
		if ( propertyName == null ) {
			return ArrayHelper.slice(
					toColumns( lhsPersister, columnQualifier, propertyIndex ),
					begin,
					associationType.getColumnSpan( mapping )
			);
		}
		else {
			//bad cast
			return ( (PropertyMapping) lhsPersister ).toColumns( columnQualifier, propertyName );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:JoinHelper.java

示例4: createEntityPersister

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
@Override
@SuppressWarnings( {"unchecked"})
public EntityPersister createEntityPersister(
		PersistentClass metadata,
		EntityRegionAccessStrategy cacheAccessStrategy,
		NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
		SessionFactoryImplementor factory,
		Mapping cfg) {
	Class<? extends EntityPersister> persisterClass = metadata.getEntityPersisterClass();
	if ( persisterClass == null ) {
		persisterClass = serviceRegistry.getService( PersisterClassResolver.class ).getEntityPersisterClass( metadata );
	}
	return create( persisterClass, ENTITY_PERSISTER_CONSTRUCTOR_ARGS, metadata, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory, cfg );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:PersisterFactoryImpl.java

示例5: validate

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public void validate(Mapping mapping) throws MappingException {
	super.validate(mapping);
	if ( key!=null && !key.isValid(mapping) ) {
		throw new MappingException(
				"subclass key mapping has wrong number of columns: " +
				getEntityName() +
				" type: " +
				key.getType().getName()
			);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:JoinedSubclass.java

示例6: validate

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
@Override
   public void validate(Mapping mapping) throws MappingException {
	super.validate(mapping);
	if ( !getIdentifier().isValid(mapping) ) {
		throw new MappingException(
			"identifier mapping has wrong number of columns: " +
			getEntityName() +
			" type: " +
			getIdentifier().getType().getName()
		);
	}
	checkCompositeIdentifier();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:RootClass.java

示例7: sqlCreateString

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public String sqlCreateString(Dialect dialect, Mapping mapping, String defaultCatalog, String defaultSchema)
		throws HibernateException {
	return buildSqlCreateIndexString(
			dialect,
			getName(),
			getTable(),
			getColumnIterator(),
			columnOrderMap,
			false,
			defaultCatalog,
			defaultSchema
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Index.java

示例8: validateColumns

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
	Iterator iter = getColumnIterator();
	while ( iter.hasNext() ) {
		Column col = (Column) iter.next();

		ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

		if ( columnInfo == null ) {
			throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
		}
		else {
			final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
					.startsWith( columnInfo.getTypeName().toLowerCase() )
					|| columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
			if ( !typesMatch ) {
				throw new HibernateException(
						"Wrong column type in " +
						Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
						" for column " + col.getName() +
						". Found: " + columnInfo.getTypeName().toLowerCase() +
						", expected: " + col.getSqlType( dialect, mapping )
				);
			}
		}
	}

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:Table.java

示例9: prepareTemporaryTables

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public void prepareTemporaryTables(Mapping mapping, Dialect dialect) {
	temporaryIdTableName = dialect.generateTemporaryTableName( getTable().getName() );
	if ( dialect.supportsTemporaryTables() ) {
		Table table = new Table();
		table.setName( temporaryIdTableName );
		Iterator itr = getTable().getPrimaryKey().getColumnIterator();
		while( itr.hasNext() ) {
			Column column = (Column) itr.next();
			table.addColumn( column.clone()  );
		}
		temporaryIdTableDDL = table.sqlTemporaryTableCreateString( dialect, mapping );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:PersistentClass.java

示例10: sqlCreateString

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
@Override
   public String sqlCreateString(Dialect dialect, Mapping p,
   		String defaultCatalog, String defaultSchema) {
	return dialect.getUniqueDelegate().getAlterTableToAddUniqueKeyCommand(
			this, defaultCatalog, defaultSchema
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:UniqueKey.java

示例11: getColumnSpan

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public int getColumnSpan(Mapping mapping) throws MappingException {
	Type[] types = userType.getPropertyTypes();
	int n=0;
	for ( Type type : types ) {
		n += type.getColumnSpan( mapping );
	}
	return n;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:CompositeCustomType.java

示例12: initIdentifierPropertyPaths

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
private void initIdentifierPropertyPaths(Mapping mapping) throws MappingException {
	String idProp = getIdentifierPropertyName();
	if ( idProp != null ) {
		propertyMapping.initPropertyPaths( idProp, getIdentifierType(), getIdentifierColumnNames(),
				getIdentifierColumnReaders(), getIdentifierColumnReaderTemplates(), null, mapping );
	}
	if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
		propertyMapping.initPropertyPaths( null, getIdentifierType(), getIdentifierColumnNames(),
				getIdentifierColumnReaders(), getIdentifierColumnReaderTemplates(), null, mapping );
	}
	if ( ! entityMetamodel.hasNonIdentifierPropertyNamedId() ) {
		propertyMapping.initPropertyPaths( ENTITY_ID, getIdentifierType(), getIdentifierColumnNames(),
				getIdentifierColumnReaders(), getIdentifierColumnReaderTemplates(), null, mapping );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:AbstractEntityPersister.java

示例13: initDiscriminatorPropertyPath

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
private void initDiscriminatorPropertyPath(Mapping mapping) throws MappingException {
	propertyMapping.initPropertyPaths( ENTITY_CLASS,
			getDiscriminatorType(),
			new String[]{getDiscriminatorColumnName()},
			new String[]{getDiscriminatorColumnReaders()},
			new String[]{getDiscriminatorColumnReaderTemplate()},
			new String[]{getDiscriminatorFormulaTemplate()},
			getFactory() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AbstractEntityPersister.java

示例14: getIdentifierOrUniqueKeyPropertyName

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
/**
 * The name of the property on the associated entity to which our FK
 * refers
 *
 * @param factory The mappings...
 * @return The appropriate property name.
 * @throws MappingException Generally, if unable to resolve the associated entity name
 */
public final String getIdentifierOrUniqueKeyPropertyName(Mapping factory)
throws MappingException {
	if ( isReferenceToPrimaryKey() || uniqueKeyPropertyName == null ) {
		return factory.getIdentifierPropertyName( getAssociatedEntityName() );
	}
	else {
		return uniqueKeyPropertyName;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:EntityType.java

示例15: CompositeElementPropertyMapping

import org.hibernate.engine.spi.Mapping; //导入依赖的package包/类
public CompositeElementPropertyMapping(
		String[] elementColumns,
		String[] elementColumnReaders,
		String[] elementColumnReaderTemplates, 
		String[] elementFormulaTemplates, 
		CompositeType compositeType,
		Mapping factory)
throws MappingException {

	this.compositeType = compositeType;

	initComponentPropertyPaths(null, compositeType, elementColumns, elementColumnReaders,
			elementColumnReaderTemplates, elementFormulaTemplates, factory);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:CompositeElementPropertyMapping.java


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