EntityManager injection not working inside fact models deployed as jar inside deployed application in BRMS 6

Solution Unverified - Updated -

Issue

  • As per this specific requirement a Drools project defines a bunch of rules in Business Central. The fact models, where these rules act on are uploaded in form of a jar (say, abc.jar) to define those facts and uploaded in the maven repository of Business Central. These rules are executed from a Web service application that fetches the rules from Business Central through kjars present inside Maven repository of Business Central and runs them locally i.e. in the Web service application. The fact model jar (abc.jar) is also packaged inside the Web service application to help the execution of the rules. The Web service has its own EntityManager which the underlying EAP 6 container injects just fine. According to the requirement the fact model jar (abc.jar) also needs access to the database due to which it needs access to the EntityManager inside it's code.
    e.g.
...
public class SimpleFact
{
  @PersistenceContext(unitName="FactEntity")
  static EntityManager em;
...
  public static List<String> getData() {
    List testData = new ArrayList();
...
    TypedQuery typeQuery = em.createQuery(selecteQuery, FactResult.class);
...
    return testData;
  }

...
  • The problem is that EAP 6 container is not injecting the EntityManager into the fact models as like it does for the Web service application code. Why is that? Is that because the fact model is only a Jar and not a WAR or EAR ?

Environment

  • Red Hat JBoss BRMS (BRMS)
    • 6.0.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.