rmannibucau commented on PR #321: URL: https://github.com/apache/openjpa/pull/321#issuecomment-7116858689
@cristof i would just use CDI.current() once in plugin default impl. Trick is basically to do a PluginValue (see https://github.com/apache/openjpa/blob/86e153ab7fb910c36e5a2ae6b84eaa2a90fa804e/openjpa-kernel/src/main/java/org/apache/openjpa/conf/MetaDataRepositoryValue.java for an example). then wire it in openjpaconfiguration (https://github.com/apache/openjpa/blob/master/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java#L158). The standard EE hack is: ```java final var context = new InitialContext(); final BeanManager bm; try { bm = context.lookup("java:comp/BeanManager"); } catch(final Exception e) { bm = context.lookup("java:comp/env/BeanManager"); } ``` but this one is ok with the same pattern than CDI.current().getBeanManager() for a war but for an ear it can potentially be contextual and need more integration depending ear classloading model. this is why I think it will be out of scope for v1 so just provide a default impl and containers can provider their integration using their internals to lookup the BM as needed. then if needed we can refine and add other impl and detection like for tx mgr but this looks overkill for now. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
