aws/aws-advanced-jdbc-wrapper

Custom driver name disables hibernate support of advanced postgres types

maciejwo-papayaglobal opened this issue · 5 comments

Describe the feature

For postgres-like databases, Hibernate ORM uses driver name obtained via DatabaseMetaData::getDriverName to determine driver kind, which affects the way advanced types are handled. Would id be possible to allow passthrough of the underlying driver name in certain situations?

https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDriverKind.java#L27
https://github.com/hibernate/hibernate-orm/blob/6.2/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java#L1342

Use Case

I'd like to be able to configure wrapped driver to use original driver name, so that hibernate correctly recognises it and enables native support for advanced types.

Proposed Solution

Perhaps an additional property could be defined to enable driver-name passthrough from the wrapped driver?

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

The AWS Advanced JDBC Driver version used

1.0.1

JDK version used

Temurin-17.0.6+10

Operating System and version

macOS 13.2.1

Hi @maciejwo-papayaglobal, thank you for raising this issue. We are currently working on a solution for this, we will keep you posted on our progress.

Hi @maciejwo-papayaglobal, we merged #371 which introduces a new connection plugin allowing user applications to override the driver name. Here is an example on how the plugin can be used: https://github.com/awslabs/aws-advanced-jdbc-wrapper/blob/main/examples/AWSDriverExample/src/main/java/software/amazon/DriverMetaDataConnectionPluginExample.java

Can you please check out our snapshot build and let us know if the issue persists? Thank you.

@karenc-bq it works, thank you! Sorry for late reply, I didn't expect it to be acted upon so quickly 😅

A minor question: as is, there's no way to passthrough the driver name from the underlying driver, only explicit value can be set. Would it be ok to do passthrough if the wrapperDriverName property is not set? Or perhaps another property, like i.e. wrapperDriverNamePassthrough is set to true? I can prepare a PR if you think it would be acceptable.

Regardless of the passthrough, thank you very much for help! ❤️

Hi @maciejwo-papayaglobal, please feel free to create a PR for your proposed changes. We appreciate your help! Thank you.

Thanks @karenc-bq! I'll prepare a PR, in the mean time, this issue is resolved, thank you very much for help! ❤️