當前位置: 首頁>>代碼示例>>Java>>正文


Java Insert.toStatementString方法代碼示例

本文整理匯總了Java中org.hibernate.sql.Insert.toStatementString方法的典型用法代碼示例。如果您正苦於以下問題:Java Insert.toStatementString方法的具體用法?Java Insert.toStatementString怎麽用?Java Insert.toStatementString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.sql.Insert的用法示例。


在下文中一共展示了Insert.toStatementString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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


注:本文中的org.hibernate.sql.Insert.toStatementString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。