Skip to content

Ability to set per-session entity interceptors removed from HibernateTransactionManager for Hibernate 4 [SPR-10301] #14935

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

Closed
spring-projects-issues opened this issue Feb 15, 2013 · 5 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 15, 2013

David Dulson opened SPR-10301 and commented

In previous versions it was possible to set an EntityInterceptor for a specific HibernateTransactionManager, which would use it when creating the session. This functionality has been removed. Would it be possible to have it re-added? I found it useful.

I see from #13580 I can set the entityInterceptor in the LocalSessionFactoryBean, but I don't want it globally - just for this one session.


Affects: 3.2.1

Attachments:

Referenced from: commits b979d8d, 096972d

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

The problem here is that Hibernate's underlying SessionFactory.openSession(Interceptor) method has been removed in Hibernate 4.0. We are not aware of an alternative way to specify a per-Session interceptor yet, which is why our HibernateTransactionManager for Hibernate 4 doesn't support it at this point.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

David Dulson commented

Hi Juergen

They've taken that method away, but you can replace it with:

Session newSession = getSessionFactory().withOptions().interceptor( getEntityInterceptor() ).openSession();

Can't you?

@spring-projects-issues
Copy link
Collaborator Author

David Dulson commented

As described

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good catch - thanks for pointing that out. I'll try to roll it into 3.2.2.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

David Dulson commented

Thanks - appreciate it.

@spring-projects-issues spring-projects-issues added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.2.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants