hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

Updated documentation as per Jira HHH-15049

Open asutosh936 opened this issue 2 years ago • 12 comments

asutosh936 avatar Mar 22 '22 21:03 asutosh936

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

It would be great to tweak your git commit message to start with "HHH-15049".

NathanQingyangXu avatar Apr 27 '22 00:04 NathanQingyangXu

@NathanQingyangXu - Updated commit message to start with HHH-15049

asutosh936 avatar Apr 27 '22 01:04 asutosh936

@NathanQingyangXu - Updated commit message to start with HHH-15049

@beikov could you take a look? Seems a good catch!

NathanQingyangXu avatar Apr 27 '22 01:04 NathanQingyangXu

This is a bit more complicated I think as the default value depends on whether Hibernate is bootstrapped via JPA or via the Hibernate native boot API.

The default value for JPA boot is false as you can see here: https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java#L256

Whereas true for Hibernate native boot as you can see here: https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java#L320

So IMO we should adapt the documentation to make this clear. Wdyt @sebersole and @dreab8?

beikov avatar Apr 27 '22 10:04 beikov

@beikov yeap I agree with you that it would be better if the documentation mentioned that for JPA boot this setting is ignored and the value is always false.

dreab8 avatar Apr 27 '22 11:04 dreab8

Make sense @beikov @dreab8. In that case should the current be updated as below? *hibernate.transaction.flush_before_completion* (e.g. trueorfalse(Hibernate bootstrap with JPA value will be false) )::

asutosh936 avatar Apr 27 '22 12:04 asutosh936

This is a bit more complicated I think as the default value depends on whether Hibernate is bootstrapped via JPA or via the Hibernate native boot API.

The default value for JPA boot is false as you can see here: https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java#L256

Whereas true for Hibernate native boot as you can see here: https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java#L320

So IMO we should adapt the documentation to make this clear. Wdyt @sebersole and @dreab8?

I saw it is set to TRUE by default in https://github.com/hibernate/hibernate-orm/blob/9e9a8135dc705a7fc5e5154e89fd11465f5f6589/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java#L320

Is it true that the default value depends on whether it is in JPA boot mode or Hibernate mode?

NathanQingyangXu avatar Apr 27 '22 13:04 NathanQingyangXu

Make sense @beikov @dreab8. In that case should the current be updated as below? *hibernate.transaction.flush_before_completion* (e.g. trueorfalse(Hibernate bootstrap with JPA value will be false) )::

Hold on. I think the configuration we are talking about is Hibernate specific and it should be TRUE by default; for JPA compliance configuration, we have a separate suite. Maybe we need to add a new entry as following in the JPA Compliance section (https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html#configurations-jpa-compliance) and set its default value to FALSE.

  • hibernate.jpa.compliance.transaction.flush_before_completion

@sebersole how do you think?

NathanQingyangXu avatar Apr 27 '22 16:04 NathanQingyangXu

@NathanQingyangXu for Jpa bootsrapping the EntityManagerFactoryBuilderImpl is executed first and then SessionFactoryOptionsBuilder so the value of flushBeforeCompletionEnabled is always false

dreab8 avatar Apr 28 '22 08:04 dreab8

Thanks for letting me know. So the default value is true for non-jpa boot, right? Should we update the doc and how?

On Thu., Apr. 28, 2022, 4:17 a.m. Andrea Boriero, @.***> wrote:

@NathanQingyangXu https://github.com/NathanQingyangXu for Jpa bootsrapping the EntityManagerFactoryBuilderImpl https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java#L256 is executed first and then SessionFactoryOptionsBuilder https://github.com/hibernate/hibernate-orm/blob/9e9a8135dc705a7fc5e5154e89fd11465f5f6589/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java#L320 so the value of flushBeforeCompletionEnabled is always false

— Reply to this email directly, view it on GitHub https://github.com/hibernate/hibernate-orm/pull/4898#issuecomment-1111886725, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6UYAR7YFHJWYQD7F7KLKDVHJCSJANCNFSM5RMELPAQ . You are receiving this because you were mentioned.Message ID: @.***>

NathanQingyangXu avatar Apr 28 '22 16:04 NathanQingyangXu

Maybe I misunderstood. Anyway.

On Thu., Apr. 28, 2022, 12:24 p.m. Nathan Xu, @.***> wrote:

Thanks for letting me know. So the default value is true for non-jpa boot, right? Should we update the doc and how?

On Thu., Apr. 28, 2022, 4:17 a.m. Andrea Boriero, < @.***> wrote:

@NathanQingyangXu https://github.com/NathanQingyangXu for Jpa bootsrapping the EntityManagerFactoryBuilderImpl https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java#L256 is executed first and then SessionFactoryOptionsBuilder https://github.com/hibernate/hibernate-orm/blob/9e9a8135dc705a7fc5e5154e89fd11465f5f6589/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java#L320 so the value of flushBeforeCompletionEnabled is always false

— Reply to this email directly, view it on GitHub https://github.com/hibernate/hibernate-orm/pull/4898#issuecomment-1111886725, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6UYAR7YFHJWYQD7F7KLKDVHJCSJANCNFSM5RMELPAQ . You are receiving this because you were mentioned.Message ID: @.***>

NathanQingyangXu avatar Apr 28 '22 16:04 NathanQingyangXu