diff --git a/pom.xml b/pom.xml
index d0da06ed9488157b1e2bd65abf1f16eef1798095..d39c4af76013d32cac1efdce545466d0e3ff47ed 100755
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-spatial</artifactId>
-            <version>5.0.10.Final</version>
+            <version>5.3.8.Final</version>
             <exclusions>
                 <exclusion>
                     <artifactId>postgresql</artifactId>
@@ -168,7 +168,7 @@
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
-            <version>5.0.10.Final</version>
+            <version>5.3.8.Final</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/no/nibio/vips/logic/util/IntegerArrayUserType.java b/src/main/java/no/nibio/vips/logic/util/IntegerArrayUserType.java
index 7bdb5d98873374201825f3519277de07972efd8e..876cb12003bdd0440c2fcaec1a49202f8346009b 100755
--- a/src/main/java/no/nibio/vips/logic/util/IntegerArrayUserType.java
+++ b/src/main/java/no/nibio/vips/logic/util/IntegerArrayUserType.java
@@ -27,11 +27,12 @@ import java.sql.SQLException;
 import java.sql.Types;
 import org.hibernate.HibernateException;
 import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
 import org.hibernate.usertype.UserType;
 
 /**
  * Adapted from this: http://stackoverflow.com/questions/21940642/hibernate-postgres-array-type
- * @copyright 2015 <a href="http://www.nibio.no/">NIBIO</a>
+ * @copyright 2015-2019 <a href="http://www.nibio.no/">NIBIO</a>
  * @author Tor-Einar Skog <tor-einar.skog@nibio.no>
  */
 
@@ -99,7 +100,7 @@ public class IntegerArrayUserType implements UserType {
      *
      * @throws java.sql.SQLException
      */
-    @Override
+    //@Override
     public Object nullSafeGet(
             ResultSet rs, 
             String[] names, 
@@ -133,7 +134,7 @@ public class IntegerArrayUserType implements UserType {
      *
      * @throws java.sql.SQLException
      */
-    @Override
+    //@Override
     public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
         if (value == null) {
             st.setNull(index, Types.OTHER);
@@ -216,5 +217,57 @@ public class IntegerArrayUserType implements UserType {
         return original;
     }
 
+    /**
+     * Retrieve an instance of the mapped class from a JDBC resultset. Implementors
+     * should handle possibility of null values.
+     *
+     * @param rs      a JDBC result set
+     * @param strings   the column names
+     * @param ssci
+     * @throws org.hibernate.HibernateException
+     *
+     * @throws java.sql.SQLException
+     */
+    @Override
+    public Object nullSafeGet(ResultSet rs, String[] strings, SharedSessionContractImplementor ssci, Object o) throws HibernateException, SQLException {
+        if (rs.wasNull()) {
+            return null;
+        }
+        try
+        {
+            Integer[] array = (Integer[]) rs.getArray(strings[0]).getArray();
+            return array;
+        }
+        catch(NullPointerException ex)
+        {
+           return new Integer[0];
+        }
+    }
+
+    /**
+     * Write an instance of the mapped class to a prepared statement. Implementors
+     * should handle possibility of null values. A multi-column type should be written
+     * to parameters starting from <tt>index</tt>.
+     *
+     * @param ps      a JDBC prepared statement
+     * @param o   the object to write
+     * @param i   statement parameter index
+     * @param ssci
+     * @throws org.hibernate.HibernateException
+     *
+     * @throws java.sql.SQLException
+     */
+    @Override
+    public void nullSafeSet(PreparedStatement ps, Object o, int i, SharedSessionContractImplementor ssci) throws HibernateException, SQLException {
+        if (o == null) {
+            ps.setNull(i, Types.OTHER);
+            return;
+        }
+
+        Integer[] castObject = (Integer[]) o;
+        Array array = ssci.connection().createArrayOf("integer", castObject); // The postgres array data type
+        ps.setArray(i, array);
+    }
+
 
 }
diff --git a/src/main/java/no/nibio/vips/logic/util/StringJsonUserType.java b/src/main/java/no/nibio/vips/logic/util/StringJsonUserType.java
index 92286a7aa42f40ebe0c3dafa68207456272b8281..8dffa05bb6bcc34fa5552cabc7337636d2f94475 100755
--- a/src/main/java/no/nibio/vips/logic/util/StringJsonUserType.java
+++ b/src/main/java/no/nibio/vips/logic/util/StringJsonUserType.java
@@ -26,10 +26,11 @@ import java.sql.SQLException;
 import java.sql.Types;
 import org.hibernate.HibernateException;
 import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
 import org.hibernate.usertype.UserType;
 
 /**
- * @copyright 2015 <a href="http://www.nibio.no/">NIBIO</a>
+ * @copyright 2015-2019 <a href="http://www.nibio.no/">NIBIO</a>
  * @author Tor-Einar Skog <tor-einar.skog@nibio.no>
  */
 
@@ -97,7 +98,7 @@ public class StringJsonUserType implements UserType {
      *
      * @throws java.sql.SQLException
      */
-    @Override
+    //@Override
     public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
         if(rs.getString(names[0]) == null){
             return null;
@@ -118,7 +119,7 @@ public class StringJsonUserType implements UserType {
      *
      * @throws java.sql.SQLException
      */
-    @Override
+    //@Override
     public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
         if (value == null) {
             st.setNull(index, Types.OTHER);
@@ -199,5 +200,48 @@ public class StringJsonUserType implements UserType {
         return original;
     }
 
+    
+    /**
+     * Retrieve an instance of the mapped class from a JDBC resultset. Implementors
+     * should handle possibility of null values.
+     *
+     * @param rs      a JDBC result set
+     * @param strings   the column names
+     * @param ssci
+     * @throws org.hibernate.HibernateException
+     *
+     * @throws java.sql.SQLException
+     */
+    @Override
+    public Object nullSafeGet(ResultSet rs, String[] strings, SharedSessionContractImplementor ssci, Object o) throws HibernateException, SQLException {
+        if(rs.getString(strings[0]) == null){
+            return null;
+        }
+        return rs.getString(strings[0]);
+    }
+
+    /**
+     * Write an instance of the mapped class to a prepared statement. Implementors
+     * should handle possibility of null values. A multi-column type should be written
+     * to parameters starting from <tt>index</tt>.
+     *
+     * @param ps      a JDBC prepared statement
+     * @param o   the object to write
+     * @param i   statement parameter index
+     * @param ssci
+     * @throws org.hibernate.HibernateException
+     *
+     * @throws java.sql.SQLException
+     */
+    @Override
+    public void nullSafeSet(PreparedStatement ps, Object o, int i, SharedSessionContractImplementor ssci) throws HibernateException, SQLException {
+        if (o == null) {
+            ps.setNull(i, Types.OTHER);
+            return;
+        }
+
+        ps.setObject(i, o, Types.OTHER);
+    }
+
 
 }