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


Java Insert类代码示例

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


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

示例1: generateInsertRowString

import org.hibernate.sql.Insert; //导入依赖的package包/类
/**
 * Generate the SQL INSERT that creates a new row
 */
@Override
   protected String generateInsertRowString() {
	
	Insert insert = new Insert( getDialect() )
			.setTableName( qualifiedTableName )
			.addColumns( keyColumnNames );
	
	if ( hasIdentifier) insert.addColumn( identifierColumnName );
	
	if ( hasIndex /*&& !indexIsFormula*/ ) {
		insert.addColumns( indexColumnNames, indexColumnIsSettable );
	}
	
	if ( getFactory().getSettings().isCommentsEnabled() ) {
		insert.setComment( "insert collection row " + getRole() );
	}
	
	//if ( !elementIsFormula ) {
		insert.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters );
	//}
	
	return insert.toStatementString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:BasicCollectionPersister.java

示例2: generateIdentityInsertString

import org.hibernate.sql.Insert; //导入依赖的package包/类
/**
 * Used to generate an insery statement against the root table in the
 * case of identifier generation strategies where the insert statement
 * executions actually generates the identifier value.
 *
 * @param includeProperty indices of the properties to include in the
 * insert statement.
 * @return The insert SQL statement string
 */
protected String generateIdentityInsertString(boolean[] includeProperty) {
	Insert insert = identityDelegate.prepareIdentifierGeneratingInsert();
	insert.setTableName( getTableName( 0 ) );

	// add normal properties
	for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
		if ( includeProperty[i] && isPropertyOfTable( i, 0 ) ) {
			// this property belongs on the table and is to be inserted
			insert.addColumns( getPropertyColumnNames(i), propertyColumnInsertable[i] );
		}
	}

	// add the discriminator
	addDiscriminatorToInsert( insert );

	// delegate already handles PK columns

	if ( getFactory().getSettings().isCommentsEnabled() ) {
		insert.setComment( "insert " + getEntityName() );
	}

	return insert.toStatementString();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:33,代码来源:AbstractEntityPersister.java

示例3: generateInsertRowString

import org.hibernate.sql.Insert; //导入依赖的package包/类
/**
 * Generate the SQL INSERT that creates a new row
 */
protected String generateInsertRowString() {
	
	Insert insert = new Insert( getDialect() )
			.setTableName( qualifiedTableName )
			.addColumns( keyColumnNames );
	
	if ( hasIdentifier) insert.addColumn( identifierColumnName );
	
	if ( hasIndex /*&& !indexIsFormula*/ ) {
		insert.addColumns( indexColumnNames, indexColumnIsSettable );
	}
	
	if ( getFactory().getSettings().isCommentsEnabled() ) {
		insert.setComment( "insert collection row " + getRole() );
	}
	
	//if ( !elementIsFormula ) {
		insert.addColumns( elementColumnNames, elementColumnIsSettable );
	//}
	
	return insert.toStatementString();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:26,代码来源:BasicCollectionPersister.java

示例4: setComment

import org.hibernate.sql.Insert; //导入依赖的package包/类
@Override
      public Insert setComment(String comment) {
	// don't allow comments on these insert statements as comments totally
	// blow up the Oracle getGeneratedKeys "support" :(
	LOG.disallowingInsertStatementComment();
	return this;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SequenceIdentityGenerator.java

示例5: addDiscriminatorToInsert

import org.hibernate.sql.Insert; //导入依赖的package包/类
@Override
protected void addDiscriminatorToInsert(Insert insert) {
	if ( explicitDiscriminatorColumnName != null ) {
		insert.addColumn( explicitDiscriminatorColumnName, getDiscriminatorSQLValue() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:JoinedSubclassEntityPersister.java

示例6: generateInsertString

import org.hibernate.sql.Insert; //导入依赖的package包/类
/**
 * Generate the SQL that inserts a row
 */
protected String generateInsertString(boolean identityInsert, boolean[] includeProperty, int j) {

	// todo : remove the identityInsert param and variations;
	//   identity-insert strings are now generated from generateIdentityInsertString()

	Insert insert = new Insert( getFactory().getDialect() )
			.setTableName( getTableName( j ) );

	// add normal properties
	for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
		if ( includeProperty[i] && isPropertyOfTable( i, j ) ) {
			// this property belongs on the table and is to be inserted
			insert.addColumns( getPropertyColumnNames(i), propertyColumnInsertable[i] );
		}
	}

	// add the discriminator
	if ( j == 0 ) {
		addDiscriminatorToInsert( insert );
	}

	// add the primary key
	if ( j == 0 && identityInsert ) {
		insert.addIdentityColumn( getKeyColumns( 0 )[0] );
	}
	else {
		insert.addColumns( getKeyColumns( j ) );
	}

	if ( getFactory().getSettings().isCommentsEnabled() ) {
		insert.setComment( "insert " + getEntityName() );
	}

	String result = insert.toStatementString();

	// append the SQL to return the generated identifier
	if ( j == 0 && identityInsert && useInsertSelectIdentity() ) { //TODO: suck into Insert
		result = getFactory().getDialect().appendIdentitySelectToInsert( result );
	}

	return result;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:46,代码来源:AbstractEntityPersister.java

示例7: setComment

import org.hibernate.sql.Insert; //导入依赖的package包/类
public Insert setComment(String comment) {
	// don't allow comments on these insert statements as comments totally
	// blow up the Oracle getGeneratedKeys "support" :(
	log.info( "disallowing insert statement comment for select-identity due to Oracle driver bug" );
	return this;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:7,代码来源:SequenceIdentityGenerator.java

示例8: addDiscriminatorToInsert

import org.hibernate.sql.Insert; //导入依赖的package包/类
protected void addDiscriminatorToInsert(Insert insert) {

		if (discriminatorInsertable) {
			insert.addColumn( getDiscriminatorColumnName(), discriminatorSQLValue );
		}

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

示例9: addDiscriminatorToInsert

import org.hibernate.sql.Insert; //导入依赖的package包/类
protected void addDiscriminatorToInsert(Insert insert) {} 
开发者ID:lamsfoundation,项目名称:lams,代码行数:2,代码来源:AbstractEntityPersister.java


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