| The easiest solution is to create a delegating wrapper class EntityManagerWrapper and use the wrapper object as return of a producer instead of the real instance. That way the returned object from unwrap is != the CDI context object thus avoid the WELD flaw. Creating such delegates is relatively easy with IDE support. The same solution works for EntityManagerFactory. |