You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to inject it with the custom qualifier like this.
@ApplicationScopedpublicclassEmployeeRepository {
@Inject@MyCustomEntityManagerentityManager;
publicList<Employee> allEmployees() {
returnentityManager.createQuery("select p from Employee p", Employee.class)
.getResultList();
}
}
And I got the following exception:
Unsatisfied dependencies fortype EntityManager with qualifiers @MyCustom
at injection point [BackedAnnotatedField] @Inject @MyCustom com.example.employee.EmployeeRepository.entityManager
at com.example.employee.EmployeeRepository.entityManager(EmployeeRepository.java:0)
The text was updated successfully, but these errors were encountered:
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: