Skip to content

Commit 1ebebd5

Browse files
breglerjfredericDelaporte
authored andcommitted
Add support for SAP HANA (#1662)
1 parent 8dabd92 commit 1ebebd5

File tree

153 files changed

+2582
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+2582
-221
lines changed

ShowBuildMenu.bat

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ echo E. Add a test configuration for Oracle.
5151
echo F. Add a test configuration for Oracle with managed driver.
5252
echo G. Add a test configuration for SQL Server Compact.
5353
echo H. Add a test configuration for MySql.
54+
echo I. Add a test configuration for SAP HANA.
5455
echo.
5556
echo X. Exit to main menu.
5657
echo.
5758

58-
%BUILDTOOL% prompt ABCDEFGHX
59-
if errorlevel 8 goto main-menu
59+
%BUILDTOOL% prompt ABCDEFGHIX
60+
if errorlevel 9 goto main-menu
61+
if errorlevel 8 goto test-setup-hana
6062
if errorlevel 7 goto test-setup-mysql
6163
if errorlevel 6 goto test-setup-sqlserverce
6264
if errorlevel 5 goto test-setup-oracle-managed
@@ -122,6 +124,13 @@ set LIB_FILES=
122124
set LIB_FILES2=
123125
goto test-setup-generic
124126

127+
:test-setup-hana
128+
set CONFIG_NAME=HANA
129+
set TEST_PLATFORM=AnyCPU
130+
set LIB_FILES=
131+
set LIB_FILES2=
132+
goto test-setup-generic
133+
125134
:test-setup-generic
126135
set CFGNAME=
127136
set /p CFGNAME=Enter a name for your test configuration or press enter to use default name:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This template was written to work with NHibernate.Test.
4+
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
5+
for your own use before compile tests in VisualStudio.
6+
-->
7+
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
8+
<session-factory name="NHibernate.Test">
9+
<property name="connection.driver_class">NHibernate.Driver.HanaColumnStoreDriver</property>
10+
<!-- Sap.Data.Hana does not support re-enlisting in the same transaction, wrecking many usages
11+
with NHibernate when both NHibernate and the connection performs auto-enlistment. -->
12+
<property name="connection.connection_string">
13+
Server=localhost:39015;UserID=nhibernate;Password=;
14+
Enlist=false;
15+
</property>
16+
<property name="dialect">NHibernate.Dialect.HanaColumnStoreDialect</property>
17+
</session-factory>
18+
</hibernate-configuration>

src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
2828
{
2929
return !(dialect is FirebirdDialect) &&
3030
!(dialect is Oracle8iDialect) &&
31-
!(dialect is MsSqlCeDialect);
31+
!(dialect is MsSqlCeDialect) &&
32+
!(dialect is HanaDialectBase);
3233
}
3334

3435
[Test]

src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
4141
{
4242
return !(dialect is FirebirdDialect) &&
4343
!(dialect is Oracle8iDialect) &&
44-
!(dialect is MsSqlCeDialect);
44+
!(dialect is MsSqlCeDialect) &&
45+
!(dialect is HanaDialectBase);
4546
}
4647

4748
[Test]

src/NHibernate.Test/Async/Criteria/Lambda/IntegrationFixture.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ public async Task IsTypeAsync()
264264
[Test]
265265
public async Task OverrideEagerJoinAsync()
266266
{
267+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
268+
Assert.Ignore("Support of empty inserts is required");
269+
267270
using (ISession s = OpenSession())
268271
using (ITransaction t = s.BeginTransaction())
269272
{
@@ -455,4 +458,4 @@ public async Task StatelessSessionAsync()
455458
}
456459
}
457460
}
458-
}
461+
}

src/NHibernate.Test/Async/Events/Collections/AbstractCollectionEventFixture.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using System.Collections.Generic;
1313
using NHibernate.Collection;
1414
using NHibernate.Collection.Generic;
15-
using NHibernate.Event;
1615
using NHibernate.Test.Events.Collections.Association.Bidirectional.ManyToMany;
1716
using NUnit.Framework;
1817

@@ -23,6 +22,11 @@ namespace NHibernate.Test.Events.Collections
2322
[TestFixture]
2423
public abstract class AbstractCollectionEventFixtureAsync : TestCase
2524
{
25+
protected override bool AppliesTo(Dialect.Dialect dialect)
26+
{
27+
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
28+
}
29+
2630
protected override string MappingsAssembly
2731
{
2832
get { return "NHibernate.Test"; }

src/NHibernate.Test/Async/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ protected override string MappingsAssembly
2929

3030
protected override bool AppliesTo(Dialect.Dialect dialect)
3131
{
32-
return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect);
32+
return dialect.SupportsSequences &&
33+
!(dialect is Dialect.MsSql2012Dialect) &&
34+
!(dialect is Dialect.HanaDialectBase); // SAP HANA does not support a syntax allowing to return the inserted id as an output parameter or a return value
3335
}
3436

3537
[Test]
@@ -49,4 +51,4 @@ public async Task SequenceIdentityGeneratorAsync()
4951
session.Close();
5052
}
5153
}
52-
}
54+
}

src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public async Task CRUDAsync()
5353
[Test]
5454
public async Task CRUDABAsync()
5555
{
56+
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
57+
Assert.Ignore("Support of empty inserts is required");
58+
5659
var entity = new A<B>
5760
{
5861
Property = new B { Prop = 2 },

src/NHibernate.Test/Async/Hql/HQLFunctions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,13 @@ public async Task CastAsync()
947947
throw;
948948
}
949949
}
950+
else if (Dialect is HanaDialectBase)
951+
{
952+
string msgToCheck =
953+
"not a GROUP BY expression: 'ANIMAL0_.BODYWEIGHT' must be in group by clause";
954+
if (!ex.InnerException.Message.Contains(msgToCheck))
955+
throw;
956+
}
950957
else
951958
{
952959
string msgToCheck =
@@ -1144,7 +1151,7 @@ public async Task StrAsync()
11441151
[Test]
11451152
public async Task IifAsync()
11461153
{
1147-
AssumeFunctionSupported("Iif");
1154+
AssumeFunctionSupported("iif");
11481155
using (ISession s = OpenSession())
11491156
{
11501157
await (s.SaveAsync(new MaterialResource("Flash card 512MB", "A001/07", MaterialResource.MaterialState.Available)));

src/NHibernate.Test/Async/Insertordering/FamilyModel/Fixture.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ protected override string MappingsAssembly
2929
get { return "NHibernate.Test"; }
3030
}
3131

32+
protected override bool AppliesTo(Dialect.Dialect dialect)
33+
{
34+
return TestDialect.SupportsBatchingDependentDML;
35+
}
36+
3237
protected override void Configure(Configuration configuration)
3338
{
3439
configuration.DataBaseIntegration(x =>
@@ -105,4 +110,4 @@ public async System.Threading.Tasks.Task CircularReferencesAsync()
105110
}
106111
}
107112
}
108-
}
113+
}

0 commit comments

Comments
 (0)