![](/img/trans.png)
[英]How does one set the default Eclipselink CacheCoordinateType in the persistence.xml?
[英]Where to set EclipseLink properties using Glassfish if not set in persistence.xml
有沒有辦法在不同於persistence.xml
的地方設置EclipseLink屬性(例如目標數據庫)?
Rational:我有一個JPA模塊,定義數據結構並包含persistence.xml
。 該模塊可能與不同的目標數據庫一起使用。 在Java SE應用程序中,可以在創建EntityManagerFactory
時以編程方式設置eclipse鏈接屬性。 但是,如果將JPA模塊打包到Glassfish應用程序服務器的EAR中,則必須在persistence.xml
定義目標數據庫……還是還有其他方法?
您可以使用RESOURCE_LOCAL持久性單元,並通過EntityManagerFactory以相同的方式訪問它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.