what is the right path to refer a jar file in jpa persistence.xml in a web app?

前端 未结 4 1243
南旧
南旧 2020-11-27 18:26

persistence.xml looks like this:


    org.hibernate.ejb.Hiber         


        
4条回答
  •  没有蜡笔的小新
    2020-11-27 19:19

    just in case someone else stumbles upon this: the jar-file-statement is only valid. when the persistence-unit is deployed as part of an Enterprise Archives (.ear) - in every other case (.war), the persistence.xml must reside in /META-INF/ and cannot refrence classes that live outside the persistence-unit (see: http://javahowto.blogspot.com/2007/06/where-to-put-persistencexml-in-web-app.html). So, as far as I know, there is no way to have a persistence.xml living in WEB-INF/classes/META-INF that references classes that do not live in WEB-INF/classes.

提交回复
热议问题