1

Using the following config in persistence.xml

<property name="eclipselink.flush-clear.cache" value="Drop"/>
<property name="eclipselink.cache.shared.default" value="false"/>
<property name="eclipselink.cache.shared" value="false"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>

According to the docs that is the configuration:

EclipseLink will attempt to DROP all tables, then CREATE all tables. If any issues are encountered, EclipseLink will follow the default behavior of your specific database and JDBC driver combination, then continue with the next statement.

This is useful in development if the schema frequently changes or during testing when the existing data needs to be cleared.

Note: Using drop-and-create will remove all of the data in the tables when they are dropped. You should never use option on a production schema that has valuable data in the database. If the schema changed dramatically, there could be old constraints in the database that prevent the dropping of the old tables. This may require the old schema to be dropped through another mechanism.

Using the following dependencies:

<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
    <version>2.7.3</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>org.eclipse.persistence.jpa</artifactId>
    <version>2.7.3</version>
</dependency>

What am I doing wrong ?

esteban rincon
  • 1,781
  • 1
  • 21
  • 40
  • What happens when you use the persistence unit? This setting is only triggered when the persistence unit is deployed, which is done lazily and might only get triggered when first accessed. You can also try using the "eclipselink.deploy-on-startup" property to force it to occur earlier: https://www.eclipse.org/eclipselink/api/2.4/org/eclipse/persistence/config/PersistenceUnitProperties.html#DEPLOY_ON_STARTUP – Chris Aug 20 '18 at 17:49

0 Answers0