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


Java Table.addCheckConstraint方法代码示例

本文整理汇总了Java中org.hibernate.mapping.Table.addCheckConstraint方法的典型用法代码示例。如果您正苦于以下问题:Java Table.addCheckConstraint方法的具体用法?Java Table.addCheckConstraint怎么用?Java Table.addCheckConstraint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.mapping.Table的用法示例。


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

示例1: bindJoinedSubclass

import org.hibernate.mapping.Table; //导入方法依赖的package包/类
public static void bindJoinedSubclass(Element node, JoinedSubclass joinedSubclass,
		Mappings mappings, java.util.Map inheritedMetas) throws MappingException {

	bindClass( node, joinedSubclass, mappings, inheritedMetas );
	inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from
																// <joined-subclass>

	// joined subclasses
	Attribute schemaNode = node.attribute( "schema" );
	String schema = schemaNode == null ?
			mappings.getSchemaName() : schemaNode.getValue();

	Attribute catalogNode = node.attribute( "catalog" );
	String catalog = catalogNode == null ?
			mappings.getCatalogName() : catalogNode.getValue();

	Table mytable = mappings.addTable(
			schema,
			catalog,
			getClassTableName( joinedSubclass, node, schema, catalog, null, mappings ),
			getSubselect( node ),
			false
		);
	joinedSubclass.setTable( mytable );
	bindComment(mytable, node);

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Mapping joined-subclass: %s -> %s", joinedSubclass.getEntityName(), joinedSubclass.getTable().getName() );
	}

	// KEY
	Element keyNode = node.element( "key" );
	SimpleValue key = new DependantValue( mappings, mytable, joinedSubclass.getIdentifier() );
	joinedSubclass.setKey( key );
	key.setCascadeDeleteEnabled( "cascade".equals( keyNode.attributeValue( "on-delete" ) ) );
	bindSimpleValue( keyNode, key, false, joinedSubclass.getEntityName(), mappings );

	// model.getKey().setType( new Type( model.getIdentifier() ) );
	joinedSubclass.createPrimaryKey();
	joinedSubclass.createForeignKey();

	// CHECK
	Attribute chNode = node.attribute( "check" );
	if ( chNode != null ) mytable.addCheckConstraint( chNode.getValue() );

	// properties
	createClassProperties( node, joinedSubclass, mappings, inheritedMetas );

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

示例2: buildAndFillTable

import org.hibernate.mapping.Table; //导入方法依赖的package包/类
public static Table buildAndFillTable(
		String schema,
		String catalog,
		ObjectNameSource nameSource,
		ObjectNameNormalizer.NamingStrategyHelper namingStrategyHelper,
		boolean isAbstract,
		List<UniqueConstraintHolder> uniqueConstraints,
		List<JPAIndexHolder> jpaIndexHolders,
		String constraints,
		Table denormalizedSuperTable,
		Mappings mappings,
		String subselect){
	schema = BinderHelper.isEmptyAnnotationValue( schema ) ? mappings.getSchemaName() : schema;
	catalog = BinderHelper.isEmptyAnnotationValue( catalog ) ? mappings.getCatalogName() : catalog;

	String realTableName = mappings.getObjectNameNormalizer().normalizeDatabaseIdentifier(
			nameSource.getExplicitName(),
			namingStrategyHelper
	);

	final Table table;
	if ( denormalizedSuperTable != null ) {
		table = mappings.addDenormalizedTable(
				schema,
				catalog,
				realTableName,
				isAbstract,
				subselect,
				denormalizedSuperTable
		);
	}
	else {
		table = mappings.addTable(
				schema,
				catalog,
				realTableName,
				subselect,
				isAbstract
		);
	}

	if ( CollectionHelper.isNotEmpty( uniqueConstraints ) ) {
		mappings.addUniqueConstraintHolders( table, uniqueConstraints );
	}

	if ( CollectionHelper.isNotEmpty( jpaIndexHolders ) ) {
		mappings.addJpaIndexHolders( table, jpaIndexHolders );
	}

	if ( constraints != null ) table.addCheckConstraint( constraints );

	// logicalName is null if we are in the second pass
	final String logicalName = nameSource.getLogicalName();
	if ( logicalName != null ) {
		mappings.addTableBinding( schema, catalog, logicalName, realTableName, denormalizedSuperTable );
	}
	return table;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:59,代码来源:TableBinder.java

示例3: fillTable

import org.hibernate.mapping.Table; //导入方法依赖的package包/类
/**
 * @deprecated Use {@link #buildAndFillTable} instead.
 */
@Deprecated
   @SuppressWarnings({ "JavaDoc" })
public static Table fillTable(
		String schema,
		String catalog,
		String realTableName,
		String logicalName,
		boolean isAbstract,
		List uniqueConstraints,
		String constraints,
		Table denormalizedSuperTable,
		Mappings mappings) {
	schema = BinderHelper.isEmptyAnnotationValue( schema ) ? mappings.getSchemaName() : schema;
	catalog = BinderHelper.isEmptyAnnotationValue( catalog ) ? mappings.getCatalogName() : catalog;
	Table table;
	if ( denormalizedSuperTable != null ) {
		table = mappings.addDenormalizedTable(
				schema,
				catalog,
				realTableName,
				isAbstract,
				null, //subselect
				denormalizedSuperTable
		);
	}
	else {
		table = mappings.addTable(
				schema,
				catalog,
				realTableName,
				null, //subselect
				isAbstract
		);
	}
	if ( uniqueConstraints != null && uniqueConstraints.size() > 0 ) {
		mappings.addUniqueConstraints( table, uniqueConstraints );
	}
	if ( constraints != null ) table.addCheckConstraint( constraints );
	//logicalName is null if we are in the second pass
	if ( logicalName != null ) {
		mappings.addTableBinding( schema, catalog, logicalName, realTableName, denormalizedSuperTable );
	}
	return table;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:48,代码来源:TableBinder.java


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