Skip to content

Add support for SAP HANA #1662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions ShowBuildMenu.bat
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ echo E. Add a test configuration for Oracle.
echo F. Add a test configuration for Oracle with managed driver.
echo G. Add a test configuration for SQL Server Compact.
echo H. Add a test configuration for MySql.
echo I. Add a test configuration for SAP HANA.
echo.
echo X. Exit to main menu.
echo.

%BUILDTOOL% prompt ABCDEFGHX
if errorlevel 8 goto main-menu
%BUILDTOOL% prompt ABCDEFGHIX
if errorlevel 9 goto main-menu
if errorlevel 8 goto test-setup-hana
if errorlevel 7 goto test-setup-mysql
if errorlevel 6 goto test-setup-sqlserverce
if errorlevel 5 goto test-setup-oracle-managed
Expand Down Expand Up @@ -122,6 +124,13 @@ set LIB_FILES=
set LIB_FILES2=
goto test-setup-generic

:test-setup-hana
set CONFIG_NAME=HANA
set TEST_PLATFORM=AnyCPU
set LIB_FILES=
set LIB_FILES2=
goto test-setup-generic

:test-setup-generic
set CFGNAME=
set /p CFGNAME=Enter a name for your test configuration or press enter to use default name:
Expand Down
18 changes: 18 additions & 0 deletions src/NHibernate.Config.Templates/HANA.cfg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.HanaColumnStoreDriver</property>
<!-- Sap.Data.Hana does not support re-enlisting in the same transaction, wrecking many usages
with NHibernate when both NHibernate and the connection performs auto-enlistment. -->
<property name="connection.connection_string">
Server=localhost:39015;UserID=nhibernate;Password=;
Enlist=false;
</property>
<property name="dialect">NHibernate.Dialect.HanaColumnStoreDialect</property>
</session-factory>
</hibernate-configuration>
3 changes: 2 additions & 1 deletion src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is FirebirdDialect) &&
!(dialect is Oracle8iDialect) &&
!(dialect is MsSqlCeDialect);
!(dialect is MsSqlCeDialect) &&
!(dialect is HanaDialectBase);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is FirebirdDialect) &&
!(dialect is Oracle8iDialect) &&
!(dialect is MsSqlCeDialect);
!(dialect is MsSqlCeDialect) &&
!(dialect is HanaDialectBase);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ public async Task IsTypeAsync()
[Test]
public async Task OverrideEagerJoinAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

using (ISession s = OpenSession())
using (ITransaction t = s.BeginTransaction())
{
Expand Down Expand Up @@ -455,4 +458,4 @@ public async Task StatelessSessionAsync()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System.Collections.Generic;
using NHibernate.Collection;
using NHibernate.Collection.Generic;
using NHibernate.Event;
using NHibernate.Test.Events.Collections.Association.Bidirectional.ManyToMany;
using NUnit.Framework;

Expand All @@ -23,6 +22,11 @@ namespace NHibernate.Test.Events.Collections
[TestFixture]
public abstract class AbstractCollectionEventFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator;
}

protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ protected override string MappingsAssembly

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect);
return dialect.SupportsSequences &&
!(dialect is Dialect.MsSql2012Dialect) &&
!(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
}

[Test]
Expand All @@ -49,4 +51,4 @@ public async Task SequenceIdentityGeneratorAsync()
session.Close();
}
}
}
}
3 changes: 3 additions & 0 deletions src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public async Task CRUDAsync()
[Test]
public async Task CRUDABAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

var entity = new A<B>
{
Property = new B { Prop = 2 },
Expand Down
9 changes: 8 additions & 1 deletion src/NHibernate.Test/Async/Hql/HQLFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,13 @@ public async Task CastAsync()
throw;
}
}
else if (Dialect is HanaDialectBase)
{
string msgToCheck =
"not a GROUP BY expression: 'ANIMAL0_.BODYWEIGHT' must be in group by clause";
if (!ex.InnerException.Message.Contains(msgToCheck))
throw;
}
else
{
string msgToCheck =
Expand Down Expand Up @@ -1144,7 +1151,7 @@ public async Task StrAsync()
[Test]
public async Task IifAsync()
{
AssumeFunctionSupported("Iif");
AssumeFunctionSupported("iif");
using (ISession s = OpenSession())
{
await (s.SaveAsync(new MaterialResource("Flash card 512MB", "A001/07", MaterialResource.MaterialState.Available)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ protected override string MappingsAssembly
get { return "NHibernate.Test"; }
}

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return TestDialect.SupportsBatchingDependentDML;
}

protected override void Configure(Configuration configuration)
{
configuration.DataBaseIntegration(x =>
Expand Down Expand Up @@ -105,4 +110,4 @@ public async System.Threading.Tasks.Task CircularReferencesAsync()
}
}
}
}
}
5 changes: 4 additions & 1 deletion src/NHibernate.Test/Async/Legacy/FooBarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ public async Task CollectionsInSelectAsync()
// probably the conversion ProxyArray.id (to_number ensuring a not null value)
// Indeed, ProxyArray.id is Glarch.tha_key which is a string filled with a Guid. It does
// not fail with most engine likely because there are no results thanks to other conditions.
if (!(Dialect is Oracle8iDialect) && !(Dialect is MsSqlCeDialect))
if (!(Dialect is Oracle8iDialect) && !(Dialect is MsSqlCeDialect) && !(Dialect is HanaDialectBase))
{
await (s.CreateQuery(
"select count(*) from Bar as bar join bar.Component.Glarch.ProxyArray as g where cast(g.id as Int32) in indices(bar.Baz.FooArray)").
Expand Down Expand Up @@ -4103,6 +4103,9 @@ public async Task UpdateOrderAsync()
[Test]
public async Task UpdateFromTransientAsync()
{
if (!TestDialect.SupportsBatchingDependentDML)
Assert.Ignore($"Dialect {Dialect} does not support batching of dependent DML (fee update on related fee)");

ISession s = OpenSession();
Fee fee1 = new Fee();
await (s.SaveAsync(fee1));
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/Legacy/FumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,4 +727,4 @@ private ISession SpoofSerialization(ISession session)
return (ISession) formatter.Deserialize(stream);
}
}
}
}
24 changes: 24 additions & 0 deletions src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ protected override IList Mappings
[Test]
public async Task ParentChildrenAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession session = OpenSession();

M parent = new M();
Expand Down Expand Up @@ -842,6 +845,9 @@ public async Task MixNativeAssignedAsync()
[Test]
public async Task CollectionReplaceOnUpdateAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
Expand Down Expand Up @@ -887,6 +893,9 @@ public async Task CollectionReplaceOnUpdateAsync()
[Test]
public async Task CollectionReplace2Async()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
Expand Down Expand Up @@ -926,6 +935,9 @@ public async Task CollectionReplace2Async()
[Test]
public async Task CollectionReplaceAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Category c = new Category();
Expand Down Expand Up @@ -971,6 +983,9 @@ public async Task CollectionReplaceAsync()
[Test]
public async Task CategoriesAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

Category c = new Category();
c.Name = Category.RootCategory;
Category c1 = new Category();
Expand Down Expand Up @@ -1012,6 +1027,9 @@ public async Task CategoriesAsync()
[Test]
public async Task CollectionRefreshAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
Category c = new Category();
IList<Category> list = new List<Category>();
Expand Down Expand Up @@ -1055,6 +1073,9 @@ public async Task CollectionRefreshAsync()
[Test]
public async Task CachedCollectionRefreshAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
Category c = new Category();
IList<Category> list = new List<Category>();
Expand Down Expand Up @@ -1240,6 +1261,9 @@ public async Task QueuedBagAddsAsync()
[Test]
public async Task PolymorphicCriteriaAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction txn = s.BeginTransaction();
Category f = new Category();
Expand Down
21 changes: 12 additions & 9 deletions src/NHibernate.Test/Async/Legacy/MultiTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public async Task QueriesAsync()
ISession s = OpenSession();
long id = 1L;

if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
id = (long) await (s.SaveAsync(new TrivialClass()));
}
Expand Down Expand Up @@ -184,7 +184,7 @@ public async Task ConstraintsAsync()
ITransaction t = s.BeginTransaction();
SubMulti sm = new SubMulti();
sm.Amount = 66.5f;
if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
await (s.SaveAsync(sm));
}
Expand Down Expand Up @@ -215,7 +215,7 @@ public async Task MultiTableAsync()
simp.Name = "simp";
object mid;
object sid;
if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
mid = await (s.SaveAsync(multi));
sid = await (s.SaveAsync(simp));
Expand All @@ -230,7 +230,7 @@ public async Task MultiTableAsync()
SubMulti sm = new SubMulti();
sm.Amount = 66.5f;
object smid;
if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
smid = await (s.SaveAsync(sm));
}
Expand Down Expand Up @@ -464,7 +464,7 @@ public async Task MultiTableCollectionsAsync()
simp.Name = "simp";
object mid;
object sid;
if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
mid = await (s.SaveAsync(multi));
sid = await (s.SaveAsync(simp));
Expand All @@ -484,7 +484,7 @@ public async Task MultiTableCollectionsAsync()
ls.Set = new HashSet<Top> { multi, simp };

object id;
if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
id = await (s.SaveAsync(ls));
}
Expand Down Expand Up @@ -541,7 +541,7 @@ public async Task MultiTableManyToOneAsync()
simp.Name = "simp";
object mid;

if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
mid = await (s.SaveAsync(multi));
}
Expand All @@ -556,7 +556,7 @@ public async Task MultiTableManyToOneAsync()
ls.YetAnother = ls;
ls.Name = "Less Simple";
object id;
if (Dialect is MsSql2000Dialect)
if (TestDialect.HasIdentityNativeGenerator)
{
id = await (s.SaveAsync(ls));
}
Expand Down Expand Up @@ -602,6 +602,9 @@ public async Task MultiTableNativeIdAsync()
[Test]
public async Task CollectionAsync()
{
if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
Assert.Ignore("Support of empty inserts is required");

ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
Multi multi1 = new Multi();
Expand Down Expand Up @@ -701,4 +704,4 @@ public async Task DynamicUpdateAsync()
}
}
}
}
}
Loading