[jpa] Make annotations a bit more coherent
authorGuillaume Nodet <gnodet@apache.org>
Fri, 15 Apr 2016 08:58:15 +0000 (10:58 +0200)
committerGuillaume Nodet <gnodet@apache.org>
Fri, 15 Apr 2016 08:58:15 +0000 (10:58 +0200)
karaf-boot-samples/karaf-boot-sample-jpa/src/main/java/sample/jpa/Task.java
karaf-boot-starters/karaf-boot-starter-jpa/src/main/java/org/apache/karaf/boot/jpa/Hibernate.java

index 63995c0..cd431a7 100644 (file)
@@ -28,7 +28,8 @@ import org.apache.karaf.boot.jpa.Provider;
 @PersistentUnit(name = "tasklist", provider = Provider.Hibernate, properties = {
         @Property(name = "hibernate.hbm2ddl.auto", value = "create-drop")
 })
-@Hibernate.Dialect(Hibernate.DialectType.HSQL)
+@Hibernate.Dialect(Hibernate.Dialect.Value.HSQL)
+@Hibernate.Hbm2DdlAuto(Hibernate.Hbm2DdlAuto.Value.CreateDrop)
 @Entity
 @XmlRootElement
 public class Task {
index 06361d4..ae4dab3 100644 (file)
@@ -20,73 +20,71 @@ public interface Hibernate {
     @Target(ElementType.TYPE)
     @Retention(RetentionPolicy.SOURCE)
     @interface Hbm2DdlAuto {
-        Hbm2DdlAutoType value();
+        Value value();
+        enum Value {
+            Validate,
+            Update,
+            Create,
+            CreateDrop;
+
+            public String toString() {
+                return super.toString().toLowerCase();
+            }
+        }
     }
 
     @ProviderProperty("hibernate.dialect")
     @Target(ElementType.TYPE)
     @Retention(RetentionPolicy.SOURCE)
     @interface Dialect {
-        DialectType value();
-    }
-
-    enum DialectType {
-        Cache71,
-        DataDirectOracle9,
-        DB2390,
-        DB2400,
-        DB2,
-        Derby,
-        Firebird,
-        FrontBase,
-        H2,
-        HSQL,
-        Informix,
-        Ingres10,
-        Ingres9,
-        Ingres,
-        Interbase,
-        JDataStore,
-        Mckoi,
-        MimerSQL,
-        MySQL5,
-        MySQL5InnoDB,
-        MySQL,
-        MySQLInnoDB,
-        MySQLMyISAM,
-        Oracle10g,
-        Oracle8i,
-        Oracle9,
-        Oracle9i,
-        Oracle,
-        Pointbase,
-        PostgresPlus,
-        PostgreSQL,
-        Progress,
-        RDMSOS2200,
-        SAPDB,
-        SQLServer2008,
-        SQLServer,
-        Sybase11,
-        SybaseAnywhere,
-        SybaseASE15,
-        Sybase,
-        Teradata,
-        TimesTen;
-
-        public String toString() {
-            return "org.hibernate.dialect." + super.toString() + "Dialect";
-        }
-    }
-
-    enum Hbm2DdlAutoType {
-        Validate,
-        Update,
-        Create,
-        CreateDrop;
+        Value value();
+        enum Value {
+            Cache71,
+            DataDirectOracle9,
+            DB2390,
+            DB2400,
+            DB2,
+            Derby,
+            Firebird,
+            FrontBase,
+            H2,
+            HSQL,
+            Informix,
+            Ingres10,
+            Ingres9,
+            Ingres,
+            Interbase,
+            JDataStore,
+            Mckoi,
+            MimerSQL,
+            MySQL5,
+            MySQL5InnoDB,
+            MySQL,
+            MySQLInnoDB,
+            MySQLMyISAM,
+            Oracle10g,
+            Oracle8i,
+            Oracle9,
+            Oracle9i,
+            Oracle,
+            Pointbase,
+            PostgresPlus,
+            PostgreSQL,
+            Progress,
+            RDMSOS2200,
+            SAPDB,
+            SQLServer2008,
+            SQLServer,
+            Sybase11,
+            SybaseAnywhere,
+            SybaseASE15,
+            Sybase,
+            Teradata,
+            TimesTen;
 
-        public String toString() {
-            return super.toString().toLowerCase();
+            public String toString() {
+                return "org.hibernate.dialect." + super.toString() + "Dialect";
+            }
         }
     }