Better error message when EntityManager can't be produced for injection
See original GitHub issueDescribe the bug Follow up on #5521 :
when there are no entities, we automatically disable the Hibernate ORM extension, this implies that code attempting to use an injected EntityManager will get an error as the EntityManager producer is not generated either.
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type javax.persistence.EntityManager and qualifiers [@Default]
We should find a way to produce a better error message to explain this particular UnsatisfiedResolutionException
.
@mkouba could you suggest how this could be done? Does it make sense?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Cant inject EntityManager with @PersistenceContext [Error ...
You have a JTA Persistence Unit but not defined a JDBC datasource. I assume that your persistence unit is not created. Have you...
Read more >JPA problem - EntityManager is not injected - Forums - IBM
I have made the Liberty JPA tutorial to work, but now I am rebuilding the app using injected JTA EntityManager instead of using...
Read more >Managing Entities - The Java EE 6 Tutorial
The EntityManager API creates and removes persistent entity instances, finds entities by the entity's primary key, and allows queries to be run on...
Read more >Entity Manager Problem | SAP Community
Entity Manager Problem ... createSupplier(supplier);) I get the following error message: ... EJBException: Cannot perform injection over bean instance ...
Read more >Upgrading to Drupal 9 Entity.Manager Error
I run the Upgrade Status report before and made sure to update all the ... "entity.manager". in Symfony\Component\DependencyInjection\ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe a dumb idea - but do we want to forbid the whole application from running in this case? If not, one option would be that the processor can log a warning and include a mock implementation of
EntityManager
that can be injected, but whose all methods throw a reasonable exception. Not sure what you guys think about letting the application work in this case - but to me it kinda makes sense, at least with devmode, the developer’s workflow could possibly be that they first inject an EM and only then they add an entity.We just had to add a Dummy entity to one of our “persistence support” Maven modules which is using sequences, to make the
QuarkusTest
work. This is a bit awkward. Maybe it would come in handy to enable an extension via a annotation (on the test class)?