No Persistence provider for EntityManager named xxx
<p>Inside drools workbench i created java class to get entitymanager and i used inside drl files ,But my problem is that </p>

<ol>
<li>when i create new project in workbench i create project structure like maven</li>
<li>the persistence.xml is inside src/main.resources/METE-INf/persistence.xml</li>
</ol>

<p>when i call class to get entitymanager like bellow</p>

<pre><code>package demo.test;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.hibernate.jpa.HibernateEntityManagerFactory;
import org.hibernate.Session;

/**
 * This class was automatically generated by the data modeler tool.
 */

public class Factory implements java.io.Serializable {

    static final long serialVersionUID = 1L;

    public Factory() {
    }


public Session getSessionHibernate(){

  HibernateEntityManagerFactory ha = (HibernateEntityManagerFactory) Persistence
                .createEntityManagerFactory("flightdataunit");
        EntityManager emf = ha.createEntityManager();

        Session session = emf.unwrap(Session.class);

        session.beginTransaction().begin();
        return session;
}
}
</code></pre>

<p>And persistence.xml like bellow</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"&gt;
    &lt;persistence-unit name="flightdataunit" transaction-type="JTA"&gt;
        &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
        &lt;jta-data-source&gt;java:jboss/sqlserver/flightdata&lt;/jta-data-source&gt;
        &lt;class&gt;demo.test.Aircraftfleetdetail&lt;/class&gt;
        &lt;class&gt;demo.test.Flightdatacrew&lt;/class&gt;
        &lt;class&gt;demo.test.Airfield&lt;/class&gt;
        &lt;class&gt;demo.test.FlightdatacrewPK&lt;/class&gt;
        &lt;class&gt;demo.test.Flighttype&lt;/class&gt;
        &lt;class&gt;demo.test.Repository&lt;/class&gt;
        &lt;class&gt;demo.test.Seatconfig&lt;/class&gt;
        &lt;class&gt;demo.test.Aircraftidentity&lt;/class&gt;
        &lt;class&gt;demo.test.Place&lt;/class&gt;
        &lt;class&gt;demo.test.Flightdata&lt;/class&gt;
        &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
        &lt;properties&gt;
            &lt;property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/&gt;
            &lt;property name="hibernate.max_fetch_depth" value="3"/&gt;
            &lt;property name="hibernate.hbm2ddl.auto" value="update"/&gt;
            &lt;property name="hibernate.show_sql" value="false"/&gt;
            &lt;property name="hibernate.id.new_generator_mappings" value="false"/&gt;
            &lt;property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/&gt;
        &lt;/properties&gt;
    &lt;/persistence-unit&gt;
&lt;/persistence&gt;
</code></pre>

<p>and pom.xml like</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;demo&lt;/groupId&gt;
  &lt;artifactId&gt;TEST&lt;/artifactId&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;name&gt;TEST&lt;/name&gt;
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;sqlserver&lt;/groupId&gt;
      &lt;artifactId&gt;jarfile&lt;/artifactId&gt;
      &lt;version&gt;4.0&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
      &lt;version&gt;5.1.0.Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
      &lt;version&gt;1.0.0.Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
      &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;
      &lt;version&gt;1.0.2&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;antlr&lt;/groupId&gt;
      &lt;artifactId&gt;antlr&lt;/artifactId&gt;
      &lt;version&gt;2.7.6&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;commons-collections&lt;/groupId&gt;
      &lt;artifactId&gt;commons-collections&lt;/artifactId&gt;
      &lt;version&gt;3.2.2&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;dom4j&lt;/groupId&gt;
      &lt;artifactId&gt;dom4j&lt;/artifactId&gt;
      &lt;version&gt;1.6.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate.common&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
      &lt;version&gt;5.0.1.Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
      &lt;version&gt;5.1.0.Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
      &lt;artifactId&gt;jta&lt;/artifactId&gt;
      &lt;version&gt;1.1&lt;/version&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.kie&lt;/groupId&gt;
        &lt;artifactId&gt;kie-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;6.3.0.Final&lt;/version&gt;
        &lt;extensions&gt;true&lt;/extensions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
&lt;/project&gt;
</code></pre>

<p>when i tried to call Factory class i got 
no persistence provider for named XXX</p>

<p>new factory class </p>

<pre><code>package demo.test;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.hibernate.jpa.HibernateEntityManagerFactory;
import org.hibernate.Session;
import javax.ejb.Stateless;
import javax.persistence.PersistenceContext;
/**
 * This class was automatically generated by the data modeler tool.
 */

@Stateless                                                                            
public class Factory implements java.io.Serializable {

    static final long serialVersionUID = 1L;

    @PersistenceContext(unitName ="flightdataunit")
    EntityManager entityManager;

    public Factory() {
    }


public Session getSessionHibernate(){

        Session session = entityManager.unwrap(Session.class);


        return session;
}
}
</code></pre>