2
votes

I am using eclipselink and I have something like this:

@PersistenceContext(unitName = "unit1")
private EntityManager em;

Is there any way that I can specify/read the persistent unit name from a config/property file so that if I want, i can change the persistent unit name (so that it will point to a different data source)?

1
Do you have more than one persistent unit in your configuration file? If not you can just remove the unitNameAnthony Accioly

1 Answers

0
votes

Don't use injection, lookup the context in code.