-
Notifications
You must be signed in to change notification settings - Fork 173
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
Support @Inject EntityManager #2207
Comments
The issue is still existed Glassfish 8.0.0-M8/EclipseLink 5.0.0-B03, https://github.com/hantsy/jakartaee11-sandbox/actions/runs/11928004837/job/33244279869 |
Sorry but could You point me to the Jakarta Persistence Specification 3.2 https://jakarta.ee/specifications/persistence/3.2/jakarta-persistence-spec-3.2 where is |
https://in.relation.to/2024/04/01/jakarta-persistence-3/
|
But I think, that this issue should be targeted to Java EE container which handle injection |
I do not know. If it is related to Glassfish etc. Please transfer this issue to Glassfish. |
See my persistence XML file changes in 3.2, I added scope and qualifer there, when running in a Jakarta EE container, it should provider a |
This is being addeessed in this GlassFish issue: eclipse-ee4j/glassfish#25198. This issue can be closed. |
I do have to add that I think this really should be a concern of EclipseLink ultimately. This becomes more clear in the case of Piranha, which is a highly modular runtime that basically just assembles components. Each component uses the EE APIs to integrate themselves. The runtime should have no specific knowledge of any of the components being assembled. We're not there today, but we should aim for this. |
EclipseLink could add a |
From my point of view no. It should be duty of JEE servers. |
Jakarta Transactions (the implementations of it) also contain their own code for providing CDI functionality. Jakarta Faces likewise. It's just like in old Java ee versions, the container had to integrate Jax-rs and JSF etc, but by using ServletContainerInitializer implementations could integrate themselves. CDI extensions are what ServletContainerInitializers are for Servlet. Using extensions a component can integrate itself. No need for the container to do that. |
What I meant is to have an optional module in Eclipselink to provide a CDI extension. Similar to other optional modules, like moxy, json, nosql. Jakarta EE servers could enable it and use it out of the box, or could provide their own mechanism. Having an extension in Eclipselink would also allow users of plain EclipseLink to add this extension to add the built-in producers to their application if they also use CDI. The usecase is not only for app servers. |
JPA 3.2 should support injecting an
EntityManager
orEntityManagerFactory
by@Inject
.I created a simple example to verify it but found it did not work as expected.
The testing env is:
Add
scope
andqualifier
in the persistence.xml file.I tried to inject it with the custom qualifier like this.
And I got the following exception:
The text was updated successfully, but these errors were encountered: