-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
PanacheRepository injected methods cannot be made transactional #7188
Comments
Yeah, I think it's probably the same issue of the methods being injected too late and not being taken into account by the interception layer. /cc @mkouba |
Any update on this one ? I'm using 1.3.1.Final and I have the same issue (impossible to persist an entity with the repository because of transaction not being activated) |
(cc @FroMage that's the issue I was mentioning during the podcast) |
@mkouba so, why do we run ArC before the Panache enhancers? How does ArC load the bytecode to see which methods need interceptors? ClassLoader, Jandex, or using an ASM transformer? |
@FroMage I have no idea when Panache enhancers are executed. By "run" you mean the analysis of the bean classes?
We only consider methods from the Jandex. |
OK, so even if we ran ArC after we're done transforming, it would not see the new methods unless we reindexed them. Is that the best thing to do, do you think @stuartwdouglas ? |
Isn't the underlying issue here just that ArC is not intercepting default methods? #9472 |
@stuartwdouglas Nope, it's not about the default methods but about "synthetic" methods added during transformation... or at least that was my assumption ;-). |
OK, that's a very good point, because in this case all methods are defined on the superinterface. We're not introducing new methods, we're just overriding them. But perhaps what @mkouba is saying is that even if the class itself is marked as |
Aha, that's a completely different situation then. I'm sorry for confusion. In that case, Stuart's PR should work fine. |
OK great. Note that I've filed #9487 for interception of static methods. |
Describe the bug
If a class implementing the PanacheRepository is marked as
@Transactional
, methods injected by Quarkus are not transactional.Expected behavior
All public methods should be transactional. When calling e.g. persist, a transaction should be created and operation should succeed.
Actual behavior
App throws
javax.persistence.TransactionRequiredException: Transaction is not active, consider adding @Transactional to your method to automatically activate one.
To Reproduce
Steps to reproduce the behavior:
@Transactional
persist
from a non-transactional method.Configuration
# Add your application.properties here, if applicable.
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a
orver
: Windows 10java -version
: 1.8Additional context
(Add any other context about the problem here.)
The text was updated successfully, but these errors were encountered: