문제

I have this scenario in a EAR application which have the following structure:

  • Project
    • data
    • ear
    • entity
      • META-INF
        • persistence.xml
    • business
    • web

At the entity folder there is all the entity classes and a persistence.xml with the hibernate.hbm2ddl.auto property setted to create. When I deploy the jar about entity the database is generated but when I deploy the ear he isn't. Please somebody can let me know why this is happening and some way to solve it?

도움이 되었습니까?

해결책

In your EAR project you must have a META-INF/application.xml file, that includes the entity jar file:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">
  <display-name>MY_ear</display-name>
  <module>
    <ejb>ENTITY.jar</ejb><!--change the name accordingly-->
  </module>
</application>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top