Skip to content

Conversation

@asutosh936
Copy link

No description provided.

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Mar 22, 2022

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

@NathanQingyangXu
Copy link
Contributor

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

@asutosh936
Copy link
Author

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

@NathanQingyangXu
Copy link
Contributor

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

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

@beikov
Copy link
Member

beikov commented Apr 27, 2022

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?

@dreab8
Copy link
Member

dreab8 commented Apr 27, 2022

@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.

@asutosh936
Copy link
Author

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) )::

@NathanQingyangXu
Copy link
Contributor

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

this.flushBeforeCompletionEnabled = cfgService.getSetting( FLUSH_BEFORE_COMPLETION, BOOLEAN, true );

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

@NathanQingyangXu
Copy link
Contributor

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?

@dreab8
Copy link
Member

dreab8 commented Apr 28, 2022

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

@NathanQingyangXu
Copy link
Contributor

NathanQingyangXu commented Apr 28, 2022 via email

@NathanQingyangXu
Copy link
Contributor

NathanQingyangXu commented Apr 28, 2022 via email

Comment on lines +712 to 713
`*hibernate.transaction.flush_before_completion*` (e.g. `true` (default value) or `false` )::
Causes the session be flushed during the before completion phase of the transaction. If possible, use built-in and automatic session context management instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the following would be better

Suggested change
`*hibernate.transaction.flush_before_completion*` (e.g. `true` (default value) or `false` )::
Causes the session be flushed during the before completion phase of the transaction. If possible, use built-in and automatic session context management instead.
`*hibernate.transaction.flush_before_completion*` (e.g. `true` (Hibernate boot default value) or `false` (JPA boot default value) )::
Causes the session be flushed during the before completion phase of the transaction. If possible, use built-in and automatic session context management instead. When Hibernate is link:https://docs.jboss.org/hibernate/orm/current/quickstart/html_single/#hibernate-gsg-tutorial-basic-test[booted through the native API], the default value is `true`, otherwise `false`.

@dreab8 dreab8 added the 6.0 label May 4, 2022
@gavinking
Copy link
Member

We now generate these docs from the javadoc, where this setting is documented correctly.

@gavinking gavinking closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants