XML-less @Configuration (no persistence.xml) and openjpa-maven-plugin

Trying to convert my application (spring + jpa) to spring annotation based on @Configuration and get rid of spring application context xml and persistence.xml. Everything good, except for openjpa-maven-plugin 2.2.2, I use to raise the build time class will not work without persistence.xml, throwing an error:

[ERROR] Failed to fulfill the goal org.apache.openjpa: openjpa-maven-plugin: 2.2.2: strengthen (enhancer) on project myapp: Strengthen the execution of the goal org.apache.openjpa: openjpa-maven-plugin: 2.2.2: promotion failed: MetaDataFactory cannot be configured (conf.newMetaDataFactoryInstance () returns null). This may mean that no configuration properties were detected. Make sure you have META-INF / persistence.xml, that it is available in your classpath, or that the properties file that you use for configuration is available. If you are using Ant, see the attributes of the specified nested element. This can also happen if your OpenJPA distribution banks are damaged or if your security policy is too strict.

Plugin configuration

:

      <configuration>
           <includes>**/business/model/*.class</includes>
           <addDefaultConstructor>true</addDefaultConstructor>
           <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
      </configuration>

, , persistence.xml , ( 3):

<persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">
</persistence-unit>

<persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL">
</persistence-unit>

<persistence-unit name="pu3" transaction-type="RESOURCE_LOCAL">
</persistence-unit>

, , openjpa-maven-, -, .

openjpa persistence.xml?

+4

Source: https://habr.com/ru/post/1569667/


All Articles