-
Notifications
You must be signed in to change notification settings - Fork 38.5k
no transaction is in progress: AOP with proxied sessionfactory #34795
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
Comments
The problem is the fact that with a proxy This has to do with the logic in the Doing a small modification in the |
Thanks for your response. The double call matches with some of the debugging I have been doing tracing with some output statements. For a while I thought I had 2 different sessionfactory beans being called. This is a bit above my head, but it looks like getReource has a unwrapResourceIfNecessary call already in it. If I extend HibernateTransactionManager is there a way to fix it in that? |
If you override the @Override
public SessionFactory getSessionFactory() {
var sessionFactory = super.getSessionFactory();
if (sessionFactory instanceof Advised advised) {
var targetSource = advised.getTargetSource();
if (targetSource != null) {
return (SessionFactory) targetSource.getTarget();
}
}
return sessionFactory
} This will unwrap the proxy. There is probably something you can do with the |
I did a rough test and that seems to work. Thanks. I am shocked that I am the only person to wrap the session factory in a Proxy. |
Seems like AOP transaction interceptor fails to start an active transaction when the session factory is wrapped in a proxy.
Originally posted by @btpog in #34733
The text was updated successfully, but these errors were encountered: