Skip to content
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

(Feature request) when using spring-integration-jdbc and HANA DB #4009

Open
culebras opened this issue Feb 6, 2023 · 3 comments
Open

(Feature request) when using spring-integration-jdbc and HANA DB #4009

culebras opened this issue Feb 6, 2023 · 3 comments

Comments

@culebras
Copy link
Contributor

culebras commented Feb 6, 2023

In what version(s) of Spring Integration are you seeing this issue?

5.5.14

Describe the bug

Unable to start my spring-boot service when using spring-integration-jdbc and HANA DB. It looks like that it is not possible to determinate the database type when I am injecting my datasource (which uses HANA DB) to the org.springframework.integration.jdbc.lock.LockRepository. This exception is raised:

2023-02-06 14:13:28,361 WARN  [restartedMain] - [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] [] - Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'integrationDataSourceInitializer' defined in class path resource [org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration$IntegrationJdbcConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.autoconfigure.integration.IntegrationDataSourceScriptDatabaseInitializer]: Factory method 'integrationDataSourceInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type

I am using Hikari datasource, Hibernate and spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HANAColumnStoreDialect.

Expected behavior

I would expect that spring-integration-jdbc is compatible with HANA DB, but I might have wrongly assumed this. Does spring-integration-jdbc supports HANA DB? In that case this bug issue could be flagged rather as a feature request.

@culebras culebras added status: waiting-for-triage The issue need to be evaluated and its future decided type: bug labels Feb 6, 2023
@artembilan
Copy link
Member

That's wrong assumption. Better to check docs before going into the woods: https://docs.spring.io/spring-integration/reference/html/jdbc.html#supported-databases.
Hibernate and Hikari has nothing to do with this LockRepository implementation.
I'd suggest you to back off Spring Boot database auto-creation and provide respective DB tables yourself.
You can borrow an SQL script from existing DB support: https://github.com/spring-projects/spring-integration/tree/main/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc

With this ticket we probably can take a look into including a support for this DB. Just need to understand how popular it is and if it has an open source JDBC driver.

@artembilan artembilan added status: waiting-for-reporter Needs a feedback from the reporter in: jdbc and removed type: bug status: waiting-for-triage The issue need to be evaluated and its future decided labels Feb 6, 2023
@culebras culebras changed the title Bug (or possible feature request) when using spring-integration-jdbc and HANA DB (Feature request) when using spring-integration-jdbc and HANA DB Feb 7, 2023
@culebras
Copy link
Contributor Author

culebras commented Feb 7, 2023

Hello, you are right, there is no support for SAP HANA DB at the moment, I did not check the docs properly.

Actually, in my app, the int_lock table was already provided (as I have no permission to create tables from within the app), but I guess it will still fail as the other tables are somehow required. I am just interested in the LockRepository part of spring-integration-jdbc, but I imagine the support for the HANA DB has to be integrated fully in spring-integration-jdbc.

I noticed that SAP HANA DB support was recently added to spring-batch project here: spring-projects/spring-batch#1087, so I guess that is a good point to consider this DB as a popular candidate.

I would be happy to help in this integration. How exactly could I help?

@artembilan
Copy link
Member

If you don't use any other Spring Integration JDBC features, you don't need other tables, just that INT_LOCK.

For contributing such a support back to the framework, please, look first into general Contribution Guideline: https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc.

Then you need to open pull request against this issue and add something like schema-hana.sql, schema-drop-hana.sql alongside with existing schema-h2.sql, schema-mysql.sql etc.
Next you go to org.springframework.integration.jdbc.store.channel package and implement an AbstractChannelMessageStoreQueryProvider for HANA.

Another way might be a simple remapping fix in Spring Boot, if HANA is fully compatible with existing DB schema.
For example we have over there a mapping like this:

platformResolver.withDriverPlatform(DatabaseDriver.MARIADB, "mysql")

We definitely need to know what is a databaseMetaData.getDatabaseProductName() for this DB to be able to map it properly in Spring Boot in the end for IntegrationDataSourceScriptDatabaseInitializer...

@artembilan artembilan added this to the 6.1.0-M1 milestone Feb 7, 2023
@artembilan artembilan added type: enhancement and removed status: waiting-for-reporter Needs a feedback from the reporter labels Feb 7, 2023
@artembilan artembilan modified the milestones: 6.1.0-M1, 6.1.x Feb 7, 2023
@artembilan artembilan modified the milestones: 6.1.x, Backlog Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants