From cf0768aef284cf87be35a9b2d234ec371296a5d1 Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Sun, 8 Jan 2017 13:19:28 +0100
Subject: [PATCH] Better PU naming, mvn test --> mvn generate-sources

---
 .../src/main/java/CreateEntity.java                    |  8 +++++---
 .../src/main/java/SearchByIcao.java                    | 10 ++++++----
 .../src/main/resources/META-INF/persistence.xml        |  4 ++--
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/CreateEntity.java b/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/CreateEntity.java
index 850d9aedf..3657f200f 100644
--- a/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/CreateEntity.java
+++ b/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/CreateEntity.java
@@ -16,9 +16,11 @@ public class CreateEntity {
 
    static final Logger log = LogManager.getLogger(CreateEntity.class);
    
-   // This requires a corresponding entry <persistence-unit name="entitytemplatePU"> 
-   // in META-INF/persistence.xml
-   static public final String PERSISTENCE_UNIT_NAME = "entitytemplatePU";
+	/**
+	 * This refers to a corresponding element <persistence-unit name = "strategy_drop-and-create" > 
+     * in META-INF/persistence.xml re-creating the relational database schema.
+	 */
+   static public final String PERSISTENCE_UNIT_NAME = "strategy_drop-and-create";
     /**
      * @param args Unused
      */
diff --git a/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/SearchByIcao.java b/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/SearchByIcao.java
index 08f4de4e9..7f8b8d953 100644
--- a/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/SearchByIcao.java
+++ b/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/java/SearchByIcao.java
@@ -22,8 +22,10 @@ import ${package}.model.Airline_;
 public class SearchByIcao {
    static final Logger log = LogManager.getLogger(SearchByIcao.class);
 
-   // This refers to a corresponding entry <persistence-unit name="entitytemplatePU_nocreate"> 
-   // in META-INF/persistence.xml
+	/**
+	 * This refers to a corresponding element <persistence-unit name = "strategy_none" > 
+     * in META-INF/persistence.xml preserving the relational database schema.
+	 */
    static public final String PERSISTENCE_UNIT_NAME = "entitytemplatePU_nocreate";
    /**
     * @param args Unused
@@ -43,10 +45,10 @@ public class SearchByIcao {
       final Root<Airline> airlineRoot = criteria.from( Airline.class );
       criteria.select( airlineRoot );
 
-      // The subsequent line of code requires "mvn test" or equivalent triggering the metamodel generator
+      // The subsequent line of code requires "mvn generate-sources" or equivalent triggering the metamodel generator
       // when working in Eclipse. You may want to right click on your project root choosing
       //
-      // "Run As" --> "Maven test".
+      // "Run As" --> "Maven generate-sources".
       //
       // This step is being required whenever changes to your model classes in mi.intro.jpastart.model happen.
 
diff --git a/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml b/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
index 73e85f068..584aac1d0 100644
--- a/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
+++ b/ws/Archetypes/mi-maven-archetype-jpa-hibernate/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
@@ -12,7 +12,7 @@
          The <code>persistence.xml</code> file configures at least one persistence unit;
          each unit must have a unique name.
     -->
-    <persistence-unit name="entitytemplatePU">
+    <persistence-unit name="strategy_drop-and-create">
         
         <!-- 
             Hibernate will scan your classpath for mapped classes and add them automatically
@@ -70,7 +70,7 @@
     <!-- The subsequent persistence unit won't modify the database's schema 
         javax.persistence.schema-generation.database.action=none
         -->
-    <persistence-unit name="entitytemplatePU_nocreate">
+    <persistence-unit name="strategy_none">
         
         <exclude-unlisted-classes>false</exclude-unlisted-classes>
         
-- 
GitLab