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

Two small things #9911

Merged
merged 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions hibernate-core/src/main/java/org/hibernate/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@
* <p>
* Each persistent instance has a <em>persistent identity</em> determined by its type
* and identifier value. There may be at most one persistent instance with a given
* persistent identity associated with a given session. Normally, a persistent identity
* is assigned when an {@linkplain #persist(Object) instance is made persistent}, but
* when the entity identifier is {@linkplain org.hibernate.generator.OnExecutionGenerator
* generated by the database}, assignment of the persistent identity is delayed until
* the state of the entity is actually inserted in the database.
* persistent identity associated with a given session. A persistent identity is
* assigned when an {@linkplain #persist(Object) instance is made persistent}.
* <p>
* An instance of an entity class may be associated with at most one open session.
* Distinct sessions represent state with the same persistent identity using distinct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ protected Object performSaveOrReplicate(

private static Object handleGeneratedId(boolean useIdentityColumn, Object id, AbstractEntityInsertAction insert) {
if ( useIdentityColumn && insert.isEarlyInsert() ) {
if ( insert instanceof EntityIdentityInsertAction ) {
final Object generatedId = ((EntityIdentityInsertAction) insert).getGeneratedId();
if ( insert instanceof EntityIdentityInsertAction entityIdentityInsertAction ) {
final Object generatedId = entityIdentityInsertAction.getGeneratedId();
insert.handleNaturalIdPostSaveNotifications( generatedId );
return generatedId;
}
Expand Down
Loading