是否可以在META-INF以外的位置使用persistence.xml? [英] Is it possible to have persistence.xml in a location other than META-INF?

查看:155
本文介绍了是否可以在META-INF以外的位置使用persistence.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将persistence.xml放在我的应用的conf文件夹中。我如何告诉Persistence.createEntityManagerFactory应该从那里读取它?

I want to have my persistence.xml in conf folder of my app. How can I tell Persistence.createEntityManagerFactory that it should read it from there?

推荐答案

createEntityManagerFactory方法在其中搜索persistence.xml文件任何CLASSPATH元素的META-INF目录。
如果你的CLASSPATH包含conf目录,你可以在conf / META-INF / persistence.xml中放置一个EntityManagerFactory定义

The createEntityManagerFactory methods search for persistence.xml files within the META-INF directory of any CLASSPATH element. if your CLASSPATH contains the conf directory, you could place an EntityManagerFactory definition in conf/META-INF/persistence.xml

这篇关于是否可以在META-INF以外的位置使用persistence.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆