-
Notifications
You must be signed in to change notification settings - Fork 935
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
Add support for SAP HANA #1662
Changes from 3 commits
ed54937
34a46e3
d5969ce
212d109
e07c6ce
341e217
9566ee4
90055a4
8f65834
ab23ff1
51d094b
2365283
4ae2055
3e8ba0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?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.HanaDriver</property> | ||
<property name="connection.connection_string"> | ||
Server=localhost:39015;UserID=nhibernate;Password= | ||
</property> | ||
<property name="dialect">NHibernate.Dialect.HanaColumnStoreDialect</property> | ||
</session-factory> | ||
</hibernate-configuration> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ 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.AbstractHanaDialect); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there no way to provide a proper If there is no solution, please add a comment for telling why HANA is excluded, like "SAP HANA does not support a syntax allowing to return the inserted id as an output parameter or a return value". |
||
} | ||
|
||
[Test] | ||
|
@@ -49,4 +49,4 @@ public async Task SequenceIdentityGeneratorAsync() | |
session.Close(); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 toidentity
if it is supported, otherwisesequence
if supported, otherwisehilo
. The other db not supporting empty inserts does overrideNativeIdentifierGeneratorClass
for usinghilo
, thus it has a value to insert.Then the exact condition here should be
TestDialect.SupportsEmptyInserts || dialect.NativeIdentifierGeneratorClass != typeof(IdentityGenerator)
.There was a problem hiding this comment.
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 inTestDialect.SupportsEmptyInserts
then? It seems strange that you'd have to check forTestDialect.SupportsEmptyInserts
and basically everywhere add the check for theNativeIdentifierGeneratorClass
right after it. IfTestDialect.SupportsEmptyInserts
really means something else, would it make sense to introduce a new property likeTestDialect.SupportsEmptyInsertsWithNativeIdentifierGenerator
?There was a problem hiding this comment.
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 onNativeIdentifierGeneratorClass
insideSupportsEmptyInserts
would defeat its purpose.The test here does empty inserts only if the
native
generator does resolves toidentity
, otherwise it does not perform empty inserts. So when the dialect does not support empty inserts but does not resolvesnative
toidentity
, it is irrelevant to disable that test.SupportsEmptyInsertsWithNativeIdentifierGenerator
is not meaningful. But since the case is very frequent, why not adding aSupportsEmptyInsertsOrHasNonIdentityNativeGenerator
. It could be something like: