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 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class FunctionsIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This surprises me, because we already test a database which is not supposed to support this, and which does not fail in all these tests modified by this PR. I have to check what is going on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the test uses the native generator, which resolves to identity if it is supported, otherwise sequence if supported, otherwise hilo. The other db not supporting empty inserts does override NativeIdentifierGeneratorClass for using hilo, thus it has a value to insert.

Then the exact condition here should be TestDialect.SupportsEmptyInserts || dialect.NativeIdentifierGeneratorClass != typeof(IdentityGenerator).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the check for the NativeIdentifierGeneratorClass be included in TestDialect.SupportsEmptyInserts then? It seems strange that you'd have to check for TestDialect.SupportsEmptyInserts and basically everywhere add the check for the NativeIdentifierGeneratorClass right after it. If TestDialect.SupportsEmptyInserts really means something else, would it make sense to introduce a new property like TestDialect.SupportsEmptyInsertsWithNativeIdentifierGenerator?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the mapped class was using identity directly instead, testing on NativeIdentifierGeneratorClass inside SupportsEmptyInserts would defeat its purpose.

The test here does empty inserts only if the native generator does resolves to identity, otherwise it does not perform empty inserts. So when the dialect does not support empty inserts but does not resolves native to identity, it is irrelevant to disable that test.

SupportsEmptyInsertsWithNativeIdentifierGenerator is not meaningful. But since the case is very frequent, why not adding a SupportsEmptyInsertsOrHasNonIdentityNativeGenerator. It could be something like:

/// <summary>
/// Either supports inserting in a table without any column specified in the insert, or has a native
/// generator strategy resolving to something else than identity.
/// </summary>
/// <remarks>This property is useful for cases where empty inserts happens only when the entities
/// generator is <c>native</c> while the dialect uses <c>identity</c> for this generator.</remarks>
public bool SupportsEmptyInsertsOrHasNonIdentityNativeGenerator
	=> SupportsEmptyInserts || _dialect.NativeIdentifierGeneratorClass != typeof(IdentityGenerator);

}

protected override string MappingsAssembly => "NHibernate.Test";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class IntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override string MappingsAssembly { get { return "NHibernate.Test"; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ProjectIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override string MappingsAssembly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SimpleIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override string MappingsAssembly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class SubQueryIntegrationFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override string MappingsAssembly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class AbstractCollectionEventFixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override string MappingsAssembly
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class FixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override IList Mappings
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/Legacy/FooBarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static byte[] GetBytes(string str)

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override IList Mappings
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 @@ -32,7 +32,7 @@ public class FumTestAsync : TestCase

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override IList Mappings
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class MasterDetailTestAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override IList Mappings
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate.Test/Async/Legacy/MultiTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ public async Task MultiTableNativeIdAsync()
[Test]
public async Task CollectionAsync()
{
if (Dialect is AbstractHanaDialect)
if (!TestDialect.SupportsEmptyInserts)
{
Assert.Ignore("HANA does not support inserting a row without specifying any column values");
Assert.Ignore("Empty inserts are not supported by the current dialect.");
}

ISession s = OpenSession();
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/Legacy/ParentChildTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ParentChildTestAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override IList Mappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected override void OnTearDown()

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override IList Mappings

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override IList Mappings

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected override void OnTearDown()

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override IList Mappings

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class FixtureAsync : TestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
}
return TestDialect.SupportsEmptyInserts;
}

protected override IList Mappings
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ protected override string MappingsAssembly

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
}
return TestDialect.SupportsEmptyInserts;
}

protected override DebugSessionFactory BuildSessionFactory()
{
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH1301/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH1388/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FixtureAsync : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class Fixture1Async : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
}
return TestDialect.SupportsEmptyInserts;
}

/// <summary>
/// Loads the project do not call Count on the list assigned.
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class Fixture2Async : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
}
return TestDialect.SupportsEmptyInserts;
}

/// <summary>
/// Loads the project and when Scenario2 and Scenario3 are set calls Count on the list assigned.
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH1609/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory)

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH1691/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class FixtureAsync : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

private static Component GetInitializedComponent()
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH1869/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory)

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override void OnTearDown()
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH1914/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FixtureAsync : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH2328/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FixtureAsync : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override void OnSetUp()
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH2409/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class FixtureAsync : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH2703/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FixtureAsync : BugTestCase

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override void OnSetUp()
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH2705/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class TestAsync : BugTestCase

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH3050/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FixtureAsync : BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ProxyIdFixtureAsync : BugTestCase

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override void OnSetUp()
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH315/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH386/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH440/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override IList Mappings

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}


Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH473/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class FixtureAsync:BugTestCase
{
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

protected override void OnSetUp()
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH479/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH521/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH607/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH643/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

private object parentId;
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH687/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/Async/NHSpecificTest/NH704/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override string BugNumber

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is AbstractHanaDialect); // HANA does not support inserting a row without specifying any column values
return TestDialect.SupportsEmptyInserts;
}

[Test]
Expand Down
Loading