deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-1155 tableName fallback to Metamodel only when not defined on @Table
Date Mon, 23 May 2016 19:51:31 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 910164208 -> 243426f22


DELTASPIKE-1155 tableName fallback to Metamodel only when not defined on @Table

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/243426f2
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/243426f2
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/243426f2

Branch: refs/heads/master
Commit: 243426f2201bd0f552c7666ed47004deabac2856
Parents: 9101642
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon May 23 21:51:24 2016 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon May 23 21:51:24 2016 +0200

----------------------------------------------------------------------
 .../apache/deltaspike/data/impl/util/EntityUtils.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/243426f2/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
index 38ecc8a..54444b6 100755
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/util/EntityUtils.java
@@ -95,13 +95,18 @@ public final class EntityUtils
         String tableName = PersistenceUnitDescriptorProvider.getInstance().entityTableName(entityClass);
         if (StringUtils.isEmpty(tableName))
         {
-            EntityType<?> entityType = entityManager.getMetamodel().entity(entityClass);
             Table tableAnnotation = entityClass.getAnnotation(Table.class);
-            return tableAnnotation == null ? entityType.getName() : tableAnnotation.name();
+            if (tableAnnotation != null && StringUtils.isNotEmpty(tableAnnotation.name()))
+            {
+                return tableAnnotation.name();
+            }
+
+            EntityType<?> entityType = entityManager.getMetamodel().entity(entityClass);
+            return entityType.getName();
         }
         return tableName;
     }
-    
+
     public static boolean isEntityClass(Class<?> entityClass)
     {
         return EntityVerifier.INSTANCE.verify(entityClass);


Mime
View raw message