ShardedSessionImpl.isOpen() is inconsistent with SessionImpl.isOpen()

Description

Email exchange between Aviad and Max:

Aviad:
I am working on using a Spring SessionFatoryBean class, so the Shard Session can be integrated correctly with the Spring TrasnsactionManager (not distributed transactions) and the OpenSessionInViewFilter.

While debugging this issue, we encountered that the isOpen method of the ShardedSessionImpl is not acting as the hibernate session version.

In hibernate if a session is not closed then it is open, meaning every created session that wasn't closed is treated as open.

In the Shard implementation the method looks for an open HibernateSession in order to return 'true'. This issue causes an unexpected behavior with Spring Transactions, so unless there is an unseen reason for this implementation I suggest to change the method isOpen to return true as long as the session wasn't closed.

Max:
Great, I'm glad to hear you're making progress. I think I understand the issue with isOpen but let me just make sure. The problem in Shards is that a ShardedSession is only considered open if it contains at least one open Session. Since we don't open Sessions until someone performs an operation on the ShardedSession that actually requires a Session, if you create a new ShardedSession and immediately call isOpen() it will return false, whereas if you create a regular Session and immediately call isOpen() it will return true. If I understand the problem correctly that makes sense I can submit the change.

Aviad:
About the problem we discussed you did understand correctly, and I will be glad if it will be changed.

Environment

None

Status

Assignee

Max Ross

Reporter

Max Ross

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

3.0.0.Beta1
3.0.0.Beta2

Priority

Major
Configure