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

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new c90c586  DBImport: tweak Json type detection for MySQL
c90c586 is described below

commit c90c58691a209b8aa1888cf27635aa5f76a5d4d0
Author: Nikita Timofeev <stari...@gmail.com>
AuthorDate: Fri Nov 6 13:20:57 2020 +0300

    DBImport: tweak Json type detection for MySQL
---
 .../src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java 
b/cayenne-server/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
index b8f68e9..1c28171 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
@@ -198,6 +198,11 @@ public class MySQLAdapter extends JdbcAdapter {
                        // JDBC mapping for BigInteger
                }
 
+               // This is a special case for the Json type and older MySQL 
drivers (5.x)
+               if(type == Types.CHAR && "json".equals(typeName)) {
+                       type = Types.LONGVARCHAR;
+               }
+
                return super.buildAttribute(name, typeName, type, size, 
precision, allowNulls);
        }
 

Reply via email to