I am using Eclipselink in glassfish to deploy an application and I’d like to use the new Eclipse 2.3 property DEPLOY_ON_STARTUP to speed up my things a little. I am using Netbean 7.0 and glassfish 3.1.1 for my development.
My question is: How can I set this up in Persistence.xml? I tried the following and it couldn’t deploy.
<?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>
If I have to set this property in code, how do I do that? the eclipselink wiki says:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu-name", props);
But I am using @EJB annotation and I don’t manage the EntityManagerFactory or entity in my code.
Your approach does not work, because elements inside properties-element should be property-elements, which are name-value -pairs. Try
instead. I am not sure does it give such a speed improvement what you are searching, according javadocs: