<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_1_1442274028614_2277" class="">I'm working with jboss wildfly 9. I have a provider deployed as module into the :</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; wildfly &gt; modules &gt; com &gt; mycompany &gt; myprovider</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">folder. Then i have a jpa project with DAO pattern writing and reading inside my database. I want to handle the DAO transaction using JTA but in order to make the DAO class visibile to myprovider i need to put the DAO JPA project inside the modules directory too.</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">Now face the real problem: it seems i cannot use the @PersistenceContext annotation to inject the entity managare into my EntityManager varible:</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; @PersistenceContext(unitName = "KAS-Mapping") &nbsp;private EntityManager entityManager;</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">this is my persistence.xml</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp;&nbsp;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &lt;persistence version="2.1" ...&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;persistence-unit name="KAS-Mapping"&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;&nbsp;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;class&gt;my.class.persistence.model.MapGroup&lt;/class&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;clas&gt;my.class.persistence.model.MapUser&lt;/class&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;properties&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="javax.persistence.provider" value="org.hibernate.ejb.HibernatePersistence" /&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="javax.persistence.provider" value="org.hibernate.jpa.HibernatePersistenceProvider"/&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="javax.persistence.transactionType" value="JTA"/&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="javax.persistence.jtaDataSource" value="java:jboss/datasources/MyDS"/&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/properties&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/persistence-unit&gt;</div><div id="yui_3_16_0_1_1442274028614_2277" class="">&nbsp; &nbsp; &lt;/persistence&gt;&nbsp;</div><div id="yui_3_16_0_1_1442274028614_2277" class=""><br class=""></div><div id="yui_3_16_0_1_1442274028614_2277" class="">Why i cannot inject the a context into a jar modules? What am i wrong?</div><div dir="ltr" class="" id="yui_3_16_0_1_1442274028614_2441"><br class=""></div></div></body></html>