jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
189 stars 55 forks source link

Use Named or Qualifier to replace the existing PersistenceContext/PersistenceUnit #456

Closed hantsy closed 4 months ago

hantsy commented 11 months ago

When switching to CDI first, #377, I would like deprecate the existing PersistenceContext/PersistenceUnit uses @Named or @Qualifier with @Inject instead.

@Inject @Named("customerDatabase")  EntityManager em;
@Inject @CustomerDatabase  EntityManager em;

@Inject @CustomerDatabase  EntityManagerFactory emf;

@Qualifier is preferred, declaring an EMF with the same qualifiers, see #358

gavinking commented 11 months ago

Of course, if we address #377, that's the obvious thing to do. But look, we already have #377 and #309, I'm not sure we need to scatter the discussion across three different issues.