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

update deprecated hibernate properties: hibernate.temp.use_jdbc_metadata_defaults to hibernate.boot.allow_jdbc_metadata_access #30

Closed
wants to merge 2 commits into from

Conversation

ghatdev
Copy link

@ghatdev ghatdev commented Jun 17, 2024

스크린샷 2024-06-18 오전 1 24 17

cause:
hibernate provider fails with: executing statement: "HHH90000021: Encountered deprecated setting [hibernate.temp.use_jdbc_metadata_defaults], use [hibernate.boot.allow_jdbc_metadata_access] instead

fixed:
hibernate.temp.use_jdbc_metadata_defaults -> hibernate.boot.allow_jdbc_metadata_access

@a8m a8m requested review from rotemtam, dorav and giautm June 17, 2024 16:34
@dorav
Copy link
Collaborator

dorav commented Jun 18, 2024

Hi @ghatdev

Thanks for bringing this forward! I'm glad Hibernate added this as a built in feature :)

Before moving on with merging this PR, I'd like to make sure that we still support older versions of Hibernate. From what I'm seeing in the Hibernate code, Hibernate still supports the old property, just produces a deprecation warning. Instead of removing the old property, can you add the new one so that both of them are set by default?

Additionally,

  1. Do you know why you are seeing this message as an error? Deprecation warnings should not result in a failure to run the provider.
  2. The provider is suppressing log messages, thus messages should be hidden from users and not causing failures

@ghatdev
Copy link
Author

ghatdev commented Jun 18, 2024

Hi @dorav!

Answers:

  1. I don't know the reason. My other project with hibernate 6.4.4 doesn't cause this error. The error (caused by warning message) comes from hibernate 6.5.2.
  2. What I expected the same. I think I didn't mess my project configuration yet... but.. :(

Yes. I see the hibernate supports old properties yet.
But when I set up my project following atlas-hibernate docs (via standalone mode), atlas throws error below:
image

I figured out atlas generates SQL file with gradle's schema task output so the output text needs to be clean.

So I tried some changes to atlas.hcl:

data "external_schema" "hibernate" {
  program = [
    "./gradlew",
    "-q",
    "schema",
    "--rerun",
    "--warning-mode", "none", // <- off for all warnings
    "--properties", "schema-export.properties"
  ]
}

But the error is not gone.

I googled some solutions, and what I found was to configure the hibernate logging level. But I thought this was not a pretty way.

@dorav
Copy link
Collaborator

dorav commented Jun 18, 2024

I just tested it with the latest Hibernate version and it seems to be working, I'm attaching an example project. hibernate_65.zip

@ghatdev Can you please share your gradle configuration or a minimal reproducible example?

@dorav
Copy link
Collaborator

dorav commented Jun 18, 2024

I also just noticed that you are passing --rerun to the gradle task
This is not a flag that is implemented by the provider, does it have a different purpose?

@ghatdev
Copy link
Author

ghatdev commented Jun 18, 2024

Thanks for example project. I will do some tests and also send my configurations.
And I put --rerun params because If atlas once fails with the deprecation warning or some error with dirty gradle output, without --rerun, next run returns success but nothing generated in the migrations directory.

@ghatdev
Copy link
Author

ghatdev commented Jun 19, 2024

Ok. I've tested.
I think micronaut changes something on log settings.

Example project you sent me is working without any deprecation warning.
But with a new micronaut project, same deprecation warning came up.
image

This is my example project: test3.zip

@dorav
Copy link
Collaborator

dorav commented Jun 19, 2024

I managed to reproduce it using your example. It looks like when using logback, the log isn't being silenced. I tried a few different ways, but couldn't silence it.

For now you can work around this by adding this line to your schema-export.properties file:

hibernate.boot.allow_jdbc_metadata_access=false

I'd appreciate it if you can also add it to the PR and I'll merge it (instead of removing the current setting, use both settings to keep backwards compatibility)

@ghatdev
Copy link
Author

ghatdev commented Jun 19, 2024

I just added the previous settings as you told me with deprecation comment.

When I tested it with my local environment, it worked pretty well :)

dorav added a commit that referenced this pull request Jun 27, 2024
This PR integrates the changes introduced here:
#30
@dorav
Copy link
Collaborator

dorav commented Jul 11, 2024

I just added the previous settings as you told me with deprecation comment.

When I tested it with my local environment, it worked pretty well :)

Glad to hear that :)

I'm closing this PR since we merged the solution in here #32

@dorav dorav closed this Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants