I have the following case.
public enum TestEnum{
PUUNITONE("puunitone"),
PUUNITTWO("puunittwo");
private String name;
private TestEnum(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
in the EJB @stateless
class
@PersistenceContext(unitName = TestEnum.PUUNITONE.getName())
private EntityManager entityManager;
I have the following
Compilation Error: Value must be a constant
Now my question:
1. In java are enums constants or not? If yes what is the problem here?
2. Is there a way or workarround to solve this issue by using Enum as constant?
Thanks a lot for any suggestion