This is an automated email from the ASF dual-hosted git repository.

doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/master by this push:
     new 26d064a  EMPIREDB-304 bugfix enum default value
26d064a is described below

commit 26d064a4d95768ca36158c5077ddbd96f2a682c3
Author: Rainer Döbele <[email protected]>
AuthorDate: Mon Dec 30 14:43:26 2019 +0100

    EMPIREDB-304
    bugfix enum default value
---
 empire-db/src/main/java/org/apache/empire/db/DBTable.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/empire-db/src/main/java/org/apache/empire/db/DBTable.java 
b/empire-db/src/main/java/org/apache/empire/db/DBTable.java
index a0fa3a3..1fa0f80 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBTable.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBTable.java
@@ -380,10 +380,11 @@ public class DBTable extends DBRowSet implements Cloneable
      * @param enumType  defValue the default value
      * @return the new column object 
      */
-    public final DBTableColumn addColumn(String columnName, DataType type, 
double size, boolean required, Enum<?> defValue)
+    public final DBTableColumn addColumn(String columnName, DataType type, 
double size, boolean required, Enum<?> enumValue)
     { 
+        Object defValue = type.isNumeric() ? enumValue.ordinal() : 
enumValue.name();
         DBTableColumn col = this.crateAndAppendColumn(columnName, type, size, 
required, defValue);
-        col.setEnumOptions(defValue.getClass());
+        col.setEnumOptions(enumValue.getClass());
         return col;
     }
 

Reply via email to