@@ -12,11 +12,6 @@ namespace NHibernate.Test.Hql.Ast
12
12
[ TestFixture ]
13
13
public class BulkManipulation : BaseFixture
14
14
{
15
- public ISession OpenNewSession ( )
16
- {
17
- return OpenSession ( ) ;
18
- }
19
-
20
15
#region Non-exists
21
16
22
17
[ Test ]
@@ -932,6 +927,11 @@ public void DeleteOnDiscriminatorSubclass()
932
927
[ Test ]
933
928
public void DeleteOnJoinedSubclass ( )
934
929
{
930
+ if ( ! Dialect . SupportsTemporaryTables )
931
+ {
932
+ Assert . Ignore ( "Cannot perform multi-table deletes using dialect not supporting temp tables." ) ;
933
+ }
934
+
935
935
var data = new TestData ( this ) ;
936
936
data . Prepare ( ) ;
937
937
@@ -956,6 +956,11 @@ public void DeleteOnJoinedSubclass()
956
956
[ Test ]
957
957
public void DeleteOnMappedJoin ( )
958
958
{
959
+ if ( ! Dialect . SupportsTemporaryTables )
960
+ {
961
+ Assert . Ignore ( "Cannot perform multi-table deletes using dialect not supporting temp tables." ) ;
962
+ }
963
+
959
964
var data = new TestData ( this ) ;
960
965
data . Prepare ( ) ;
961
966
@@ -975,6 +980,11 @@ public void DeleteOnMappedJoin()
975
980
[ Test ]
976
981
public void DeleteUnionSubclassAbstractRoot ( )
977
982
{
983
+ if ( ! Dialect . SupportsTemporaryTables )
984
+ {
985
+ Assert . Ignore ( "Cannot perform multi-table deletes using dialect not supporting temp tables." ) ;
986
+ }
987
+
978
988
var data = new TestData ( this ) ;
979
989
data . Prepare ( ) ;
980
990
@@ -997,6 +1007,11 @@ public void DeleteUnionSubclassAbstractRoot()
997
1007
[ Test ]
998
1008
public void DeleteUnionSubclassConcreteSubclass ( )
999
1009
{
1010
+ if ( ! Dialect . SupportsTemporaryTables )
1011
+ {
1012
+ Assert . Ignore ( "Cannot perform multi-table deletes using dialect not supporting temp tables." ) ;
1013
+ }
1014
+
1000
1015
var data = new TestData ( this ) ;
1001
1016
data . Prepare ( ) ;
1002
1017
@@ -1040,6 +1055,11 @@ public void DeleteUnionSubclassLeafSubclass()
1040
1055
[ Test ]
1041
1056
public void DeleteRestrictedOnManyToOne ( )
1042
1057
{
1058
+ if ( ! Dialect . SupportsTemporaryTables )
1059
+ {
1060
+ Assert . Ignore ( "Cannot perform multi-table deletes using dialect not supporting temp tables." ) ;
1061
+ }
1062
+
1043
1063
var data = new TestData ( this ) ;
1044
1064
data . Prepare ( ) ;
1045
1065
@@ -1089,7 +1109,7 @@ public TestData(BulkManipulation tc)
1089
1109
1090
1110
public void Prepare ( )
1091
1111
{
1092
- ISession s = tc . OpenNewSession ( ) ;
1112
+ ISession s = tc . OpenSession ( ) ;
1093
1113
ITransaction txn = s . BeginTransaction ( ) ;
1094
1114
1095
1115
Polliwog = new Animal { BodyWeight = 12 , Description = "Polliwog" } ;
@@ -1152,19 +1172,27 @@ public void Prepare()
1152
1172
1153
1173
public void Cleanup ( )
1154
1174
{
1155
- ISession s = tc . OpenNewSession ( ) ;
1156
- ITransaction txn = s . BeginTransaction ( ) ;
1157
-
1158
- // workaround awesome HSQLDB "feature"
1159
- s . CreateQuery ( "delete from Animal where mother is not null or father is not null" ) . ExecuteUpdate ( ) ;
1160
- s . CreateQuery ( "delete from Animal" ) . ExecuteUpdate ( ) ;
1161
- s . CreateQuery ( "delete from Zoo" ) . ExecuteUpdate ( ) ;
1162
- s . CreateQuery ( "delete from Joiner" ) . ExecuteUpdate ( ) ;
1163
- s . CreateQuery ( "delete from Vehicle" ) . ExecuteUpdate ( ) ;
1164
- s . CreateQuery ( "delete from BooleanLiteralEntity" ) . ExecuteUpdate ( ) ;
1165
-
1166
- txn . Commit ( ) ;
1167
- s . Close ( ) ;
1175
+ if ( ! tc . Dialect . SupportsTemporaryTables )
1176
+ {
1177
+ // Give-up usual cleanup due to TPC: cannot perform multi-table deletes using dialect not supporting temp tables
1178
+ tc . DropSchema ( ) ;
1179
+ tc . CreateSchema ( ) ;
1180
+ return ;
1181
+ }
1182
+ using ( var s = tc . OpenSession ( ) )
1183
+ using ( var txn = s . BeginTransaction ( ) )
1184
+ {
1185
+ // workaround awesome HSQLDB "feature"
1186
+ s . CreateQuery ( "delete from Animal where mother is not null or father is not null" ) . ExecuteUpdate ( ) ;
1187
+ s . CreateQuery ( "delete from Animal" ) . ExecuteUpdate ( ) ;
1188
+ s . CreateQuery ( "delete from Zoo" ) . ExecuteUpdate ( ) ;
1189
+ s . CreateQuery ( "delete from Joiner" ) . ExecuteUpdate ( ) ;
1190
+ s . CreateQuery ( "delete from Vehicle" ) . ExecuteUpdate ( ) ;
1191
+ s . CreateQuery ( "delete from BooleanLiteralEntity" ) . ExecuteUpdate ( ) ;
1192
+
1193
+ txn . Commit ( ) ;
1194
+ s . Close ( ) ;
1195
+ }
1168
1196
}
1169
1197
}
1170
1198
}
0 commit comments