Comments (3)
Hi @irineuruiz. A change of the behavior would highly affect the current execution semantics.
At the moment, the UnitOfWorkApplicationListener
opens a Session
for the Jersey execution lifecycle and wraps a transaction around the execution of the resource method. If we would commit the transaction after the execution of the response filters, an exception thrown in the execution of a response filter would abort the whole transaction. But if you annotate a resource method with @UnitOfWork
, you'd expect the transaction to commit, if no exception was thrown in the resource method.
The problem you're experiencing with the UnitOfWorkAwareProxyFactory
is caused from the creation of the proxy class. This newly generated subclass doesn't inherit the @NameBinding
annotation because it's not marked @Inherited
. Therefore your annotation is not found on the proxied subclass and the name binding doesn't apply correctly.
I think the best you can do is to create a transaction yourself. The UnitOfWorkAspect
commits the transaction after the execution of the resource method but doesn't close the Session
. You can query it with ManagedSessionContext.currentSession()
and then manually open a new transaction.
from dropwizard.
Thanks @zUniQueX
In fact, we solve it here by doing exactly that, we are opening a transaction and committing it.
I just thought it would be good to warn you because we didn't know that UnitOfWorkAwareProxyFactory would "break" the NameBinding functionality and our developers took a while to understand what was happening.
from dropwizard.
@irineuruiz That's a good hint. But I think theUnitOfWorkAwareProxyFactory
isn't known so widely and other users will probably not deal with proxies themselves, if they can avoid it.
If you think this case has an impact to more users, documentation updates are greatly appreciated.
from dropwizard.
Related Issues (20)
- Vulnerability issues with dependencies in dropwizard 4.0.1 HOT 1
- IlligalAccesException : module com.fasterxml.jackson.module.blackbird does not read module *** HOT 12
- Incorrect javadocs for io.dropwizard.logging.common.AppenderFactory
- Dropwizard 4.0.3 not logging request logs HOT 2
- AWS Serverless Example HOT 1
- Jersey client 2.21 doesnt support Transfer-encoding: chunked, is there any workaround?
- Breaking change in a version between 4.0.1 and 4.0.4 HOT 3
- DropwizardJettyServerAdapter in DropWizard3 causing exception when there are multiple HttpHeaders HOT 9
- Update Logback to fix CVE-2023-6378? HOT 4
- NPE in tests when a factory is used to inject a value to a resource method parameter HOT 2
- Managed virtual thread pool HOT 2
- Deserialization failures due to Afterburner HOT 1
- Server starts and stops immediately when both enableVirtualThreads and enableAdminVirtualThreads are set to true HOT 5
- delay between tests that use DropwizardExtensionsSupport HOT 2
- Logging request and response body with RequestLogFactory HOT 2
- Dependency Injection issue in AuthFilter HOT 4
- Add cache support for stale-while-revalidate HOT 1
- Redirect log output for commands other than "server" HOT 2
- Enhancement: Make Cli ArgumentParsers locale configurable HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropwizard.