org.dbunit.ext.mssql
Class InsertIdentityOperation

java.lang.Object
  extended by org.dbunit.operation.DatabaseOperation
      extended by org.dbunit.operation.AbstractOperation
          extended by org.dbunit.ext.mssql.InsertIdentityOperation

public class InsertIdentityOperation
extends AbstractOperation

This class disable the MS SQL Server automatic identifier generation for the execution of inserts.

If you are using the Microsoft driver (i.e. com.microsoft.jdbc.sqlserver.SQLServerDriver), you'll need to use the SelectMethod=cursor parameter in the JDBC connection string. Your databaseUrl would look something like the following:

jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cursor

Thanks to Jeremy Stein who has submitted multiple patches.

Since:
1.4 (Apr 9, 2002)
Version:
$Revision: 934 $ $Date: 2008-12-31 16:29:25 -0600 (Wed, 31 Dec 2008) $
Author:
Manuel Laflamme, Eric Pugh, Last changed by: $Author: gommma $

Field Summary
static DatabaseOperation CLEAN_INSERT
           
static IColumnFilter IDENTITY_FILTER_EXTENDED
          Accepts columns that have one of the remarks GENERATED BY DEFAULT AS IDENTITY GENERATED ALWAYS AS IDENTITY set which is the SQL standard syntax to describe auto-generated key columns.
static DatabaseOperation INSERT
           
static String PROPERTY_IDENTITY_COLUMN_FILTER
           
static DatabaseOperation REFRESH
           
 
Fields inherited from class org.dbunit.operation.DatabaseOperation
DELETE, DELETE_ALL, NONE, TRUNCATE_TABLE, UPDATE
 
Constructor Summary
InsertIdentityOperation(DatabaseOperation operation)
          Creates a new InsertIdentityOperation object that decorates the specified operation.
 
Method Summary
 void execute(IDatabaseConnection connection, IDataSet dataSet)
          Executes this operation on the specified database using the specified dataset contents.
 
Methods inherited from class org.dbunit.operation.AbstractOperation
getQualifiedName
 
Methods inherited from class org.dbunit.operation.DatabaseOperation
CLOSE_CONNECTION, TRANSACTION
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_IDENTITY_COLUMN_FILTER

public static final String PROPERTY_IDENTITY_COLUMN_FILTER
See Also:
Constant Field Values

INSERT

public static final DatabaseOperation INSERT

CLEAN_INSERT

public static final DatabaseOperation CLEAN_INSERT

REFRESH

public static final DatabaseOperation REFRESH

IDENTITY_FILTER_EXTENDED

public static final IColumnFilter IDENTITY_FILTER_EXTENDED
Accepts columns that have one of the remarks set which is the SQL standard syntax to describe auto-generated key columns. Also accepts columns that have the auto-increment property set to true (note that it does not yet have the ability to check whether the column is a primary key col).

Since:
2.4.3
Constructor Detail

InsertIdentityOperation

public InsertIdentityOperation(DatabaseOperation operation)
Creates a new InsertIdentityOperation object that decorates the specified operation.

Method Detail

execute

public void execute(IDatabaseConnection connection,
                    IDataSet dataSet)
             throws DatabaseUnitException,
                    SQLException
Description copied from class: DatabaseOperation
Executes this operation on the specified database using the specified dataset contents.

Specified by:
execute in class DatabaseOperation
Parameters:
connection - the database connection.
dataSet - the dataset to be used by this operation.
Throws:
DatabaseUnitException
SQLException


Copyright © 2002-2012. All Rights Reserved.