Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
#671: add support for hana as dbType (#671)
Browse files Browse the repository at this point in the history
add support for hana as dbType, rewview rework, #671: included review improvement suggestions
  • Loading branch information
hohwille authored Sep 11, 2018
1 parent 1b73cf4 commit 7af2c85
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.5.4</version>
#elseif ($dbType == 'hana')
<groupId>com.sap.cloud.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>2.3.48</version>
#elseif ($dbType == 'oracle')
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spring.jpa.hibernate.ddl-auto=validate
# https://github.com/spring-projects/spring-boot/blob/d3c34ee3d1bfd3db4a98678c524e145ef9bca51c/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java
#if ($dbType == 'mariadb')
spring.jpa.database=mysql
#elseif ($dbType == 'hana')
# Requires spring 5.1 - see https://jira.spring.io/browse/SPR-16460
#spring.jpa.database=hana
spring.jpa.database=default
#else
spring.jpa.database=${dbType}
#end
Expand All @@ -39,6 +43,10 @@ spring.datasource.username=${rootArtifactId}
# spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
# spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=${rootArtifactId}
#elseif ($dbType == 'hana')
# spring.jpa.database-platform=org.hibernate.dialect.HANAColumnStoreDialect
# spring.datasource.driver-class-name=com.sap.db.jdbc.Driver
spring.datasource.username=${rootArtifactId}
#elseif ($dbType == 'oracle')
# spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
# spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ spring.datasource.url=jdbc:mysql://address=(protocol=tcp)(host=localhost)(port=3
#elseif ($dbType == 'mariadb')
spring.datasource.password=todo
spring.datasource.url=jdbc:mariadb://localhost:3306/db
#elseif ($dbType == 'hana')
spring.datasource.password=todo
# https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/latest/en-US/b250e7fef8614ea0a0973d58eb73bda8.html
spring.datasource.url=jdbc:sap://localhost:39015
#elseif ($dbType == 'oracle')
spring.datasource.password=todo
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/XE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Leave a large ID space reserved for master-data and test-data
CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1000000;

-- hana does not support Dateadd function out of the box so we add it here to be able to use it for master-data SQLs
CREATE FUNCTION DATEADD(IN DATETYPE NVARCHAR(256), IN NUMBER INTEGER, IN TS TIMESTAMP)
RETURNS TSADD TIMESTAMP
AS
BEGIN
IF :DATETYPE = 'DAY'
THEN
TSADD = ADD_DAYS(:TS, :NUMBER);
ELSEIF :DATETYPE = 'HOUR'
THEN
TSADD = ADD_SECONDS(:TS, :NUMBER * 3600);
ELSE
SIGNAL SQL_ERROR_CODE 10000 SET MESSAGE_TEXT = 'Unsupported date type: ' || :DATETYPE;
END IF;
END;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- *** RevInfo (Commit log for envers audit trail) ***
CREATE COLUMN TABLE RevInfo(
id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
"timestamp" BIGINT NOT NULL,
userLogin VARCHAR(255),
PRIMARY KEY (ID)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- *** BinaryObject (BLOBs) ***
CREATE COLUMN TABLE BinaryObject (
id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
modificationCounter INTEGER NOT NULL,
content BLOB,
filesize BIGINT NOT NULL,
mimeType VARCHAR(255),
CONSTRAINT PK_BinaryObject_id PRIMARY KEY(ID)
);

0 comments on commit 7af2c85

Please sign in to comment.