Skip to content

Conversation

@marko-bekhta
Copy link
Member

Based on hibernate/hibernate-orm#11093


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Nov 12, 2025

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HSEARCH-\d+
    ↳ Offending commits: [a898ad7, c219d34]

› This message was automatically generated.

// Only do this as a fallback: if somehow the session holder was added to the session properties
// before the session was closed, we definitely want to use it and avoid the static map.
holder = holderPerClosedSessionTransaction.get( session.accessTransaction() );
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @yrodiere 👋🏻 🙂

I've tried to integrate the ORM extension, and it made me wonder if this ^ could even happen with holder being attached to a session as soon as it (session) is created.
The tests passed without this static map.. but ... I'm not sure whether we actualy have any tests to hit this scenario, or we do?

Copy link
Member

Choose a reason for hiding this comment

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

Hey. It's been a long time... but I don't see a reason this would still be needed if the holder is added when creating the session.

Also, the PR that added this code seems to be specifically about closed sessions: #2450
So if the tests from that PR are still around, and still pass... +1 to remove all this code?

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh so the tests are in Spring-JTA ... but I haven't run those particular ones as I was running on JDK 25 ... let me give it another try with 21 to double check

Copy link
Member Author

Choose a reason for hiding this comment

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

ok ... so I did aaaand it works but we need to figure out the synchronisation part so that it doesn't need extra casts/unwraps. 🙂

@marko-bekhta marko-bekhta force-pushed the wip/orm-session-extension branch from 3fc04b3 to c219d34 Compare November 17, 2025 18:08
Comment on lines 209 to 227
// TODO: won't be able to use these (toEntityManager / toOrmSession / session) in a stateless session case...
// options ?
// = deprecate and introduce some shared session interface instead ?
// = keep two search session interfaces one for stateless one for stateful ?
@Override
public EntityManager toEntityManager() {
return sessionImplementor;
}

@Override
public Session toOrmSession() {
return sessionImplementor;
}

@Override
public SessionImplementor session() {
return sessionImplementor;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

we have these publicly exposed ... so I wonder what should we do about them ... (once we start the stateless session work...)

Comment on lines +358 to +360
// TODO: There's no action queue with stateless session ...
// Hence it would be great if we could just have an SPI in ORM to deal with this instead?
// TODO: Have a closer look at this part to figure the best way to deal with stateless sessions..
Copy link
Member Author

Choose a reason for hiding this comment

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

we won't have a queue in stateless session so we'd need to deal with this one way or the other 😃,
but an ORM SPI would be nice 🙂

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