title: OpenJPA and Spring-boot configuration
body: <p>Im struggling with basic configuration of spring-boot app, with OpenJPA as jpa implementation. Basically I always end up with:</p>
  
  <p>Caused by: org.apache.openjpa.util.MetaDataException: The type "class com.openjpa.example.Customer" has not been enhanced.</p>
  
  <p>My configuration looks like below:</p>
  
  <pre><code>package com.openjpa.example;
  
      @SpringBootApplication
      public class Application extends JpaBaseConfiguration {
          protected Application(DataSource dataSource, JpaProperties properties,
                  ObjectProvider&lt;JtaTransactionManager&gt; jtaTransactionManagerProvider) {
              super(dataSource, properties, jtaTransactionManagerProvider);
          }
  
          @Override
          protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
              OpenJpaVendorAdapter jpaVendorAdapter = new OpenJpaVendorAdapter();
              jpaVendorAdapter.setShowSql(true);
              return jpaVendorAdapter;
          }
  
          @Override
          protected Map&lt;String, Object&gt; getVendorProperties() {
              HashMap&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
              map.put("openjpa.Log", "DefaultLevel=TRACE, Tool=INFO, SQL=TRACE, Runtime=TRACE");
              map.put("openjpa.jdbc.MappingDefaults", "IndexLogicalForeignKeys=false,IndexDiscriminator=false");
              map.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
              map.put("openjpa.RuntimeUnenhancedClasses", "supported");
              map.put("openjpa.DynamicEnhancementAgent", "false");
              map.put("openjpa.weaving", "false");
              return map;
          }
  
          public static void main(String[] args) {
              CustomerRepository repository = SpringApplication.run(Application.class, args).getBean(CustomerRepository.class);
              repository.save(new Customer("Richard", "Feynman"));
  
  
              System.out.println(repository.findAll());
          }
      }
  </code></pre>
  
  <p>and pom.xml:</p>
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;static-weaving&lt;/id&gt;
  
              &lt;build&gt;
                  &lt;plugins&gt;
  
                  &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.openjpa&lt;/groupId&gt;
                  &lt;artifactId&gt;openjpa-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;includes&gt;**/openjpa/*.class&lt;/includes&gt;
                      &lt;addDefaultConstructor&gt;true&lt;/addDefaultConstructor&gt;
                      &lt;enforcePropertyRestrictions&gt;true&lt;/enforcePropertyRestrictions&gt;
  
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;enhancer&lt;/id&gt;
                          &lt;phase&gt;process-classes&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;enhance&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.apache.openjpa&lt;/groupId&gt;
                          &lt;artifactId&gt;openjpa&lt;/artifactId&gt;
                          &lt;version&gt;${openjpa.version}&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
  
          &lt;/profile&gt;
  
          &lt;profile&gt;
  
              &lt;id&gt;load-time-weaving&lt;/id&gt;
  
              &lt;activation&gt;
                  &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
  
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                          &lt;dependencies&gt;
                              &lt;dependency&gt;
                                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                                  &lt;artifactId&gt;spring-instrument&lt;/artifactId&gt;
                                  &lt;version&gt;${spring.version}&lt;/version&gt;
                              &lt;/dependency&gt;
                          &lt;/dependencies&gt;
                          &lt;configuration&gt;
                              &lt;argLine&gt;-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar&lt;/argLine&gt;
                          &lt;/configuration&gt;
                      &lt;/plugin&gt;
                      &lt;plugin&gt;
  
                          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                          &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                          &lt;dependencies&gt;
                              &lt;dependency&gt;
                                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                                  &lt;artifactId&gt;spring-instrument&lt;/artifactId&gt;
                                  &lt;version&gt;${spring.version}&lt;/version&gt;
                              &lt;/dependency&gt;
                          &lt;/dependencies&gt;
                          &lt;configuration&gt;
                              &lt;agent&gt;${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar&lt;/agent&gt;
                              &lt;agent&gt;${settings.localRepository}/org/apache/openjpa/openjpa/${openjpa.version}/openjpa-${openjpa.version}.jar&lt;/agent&gt;
                          &lt;/configuration&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
      &lt;/profile&gt;
  
  &lt;/profiles&gt;
  </code></pre>
  
  <p>Does anyone know what is wrong here ?</p>