No mapping for LONGVARCHAR in Hibernate 3.2

I am running Hibernate 3.2.0 with MySQL 5.1. After updating group_concat_max_len in MySQL (due to a group_concat query exceeding the default), I received the following exception when executing SQLQuery with the group_concat clause:

"No dialectic mapping for JDBC type: -1"

-1 is the value of java.sql.Types for LONGVARCHAR. Obviously, increasing the value of group_concat_max_len causes group_concat calls to return the value LONGVARCHAR. This looks like an instance of this error:

http://opensource.atlassian.com/projects/hibernate/browse/HHH-3892

I assume that in Hibernate 3.5 there is a fix for this problem, but it is still a development version, so I hesitate to put it into production and do not know if it will cause problems for other parts of my code base. I could just use JDBC queries, but then I need to replace each instance of SQLQuery with a group_concat clause.

Any other suggestions?

+3
source share
2 answers

Yes, two sentences. Or:

  • Hibernate 3.2.0 patch with changes to HHH-3892 , i.e. get Hibernate sources, apply patches for r16501 , r16823 and r17332 ) and create Hibernate yourself.

  • , HHH-1483:

    public class MySQL5Dialect extends org.hibernate.dialect.MySQL5Dialect {
        public MySQL5Dialect() {
            super();
            // register additional hibernate types for default use in scalar sqlquery type auto detection
            // http://opensource.atlassian.com/projects/hibernate/browse/HHH-1483
            registerHibernateType(Types.LONGVARCHAR, Hibernate.TEXT.getName());
        }    
    }
    

β„– 2 ( ), β„– 1 "", () . β„–1, , 3.5 , , .

+2

Pascal , .

addScalar . , group_concat, addScalar . . ( , addScalar , , group_concat.)

+1

Source: https://habr.com/ru/post/1734252/


All Articles