1
我在glassfish中使用Eclipselink部署應用程序,我想使用新的Eclipse 2.3屬性DEPLOY_ON_STARTUP加速我的事情一點。我爲我的開發使用了Netbean 7.0和glassfish 3.1.1。使用Eclipselink JPA:如何在persistence.xml中設置啓動時的部署
我的問題是:如何在Persistence.xml中設置它?我嘗試了以下方法,無法部署。
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"....
<persistence-unit name="MyPU" transaction-type="JTA">
<jta-data-source>myDataSource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<DEPLOY_ON_STARTUP>True</DEPLOY_ON_STARTUP>
</properties>
</persistence-unit>
</persistence>
如果非要在代碼中設置該屬性,我該怎麼辦呢?在維基的EclipseLink說:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu-name", props);
但是我使用@EJB註解,我不管理我的代碼的EntityManagerFactory或實體。
謝謝。有用。我的第一個Web服務調用總是很慢。通過增加這個,希望它會加快一點點。 – neo 2011-12-22 20:04:54