I saw this several times when browsing.. people are using @Inject annotation with their own to inject EntityManager like this:
@Inject @MyEm EnityManager em;
because you cannot just inject the EntityManager. You can do it only with @PersistenceContext. Does anybody know how to make this work (with the custom annotation), because I didn’t find any information on the net? Give a example if you can, please.
Basically what you need to do is create a discriminator annotation and use it in conjunction with a Producer. This allows you to simple @Inject your Entity Manager in other beans within your Java EE application. Here is an example: