Hibernate + Derby: Comparisons between 'BOOLEAN' and 'INTEGER' are not supported

前端 未结 4 1822
执笔经年
执笔经年 2021-01-13 16:32

I have a problem with querying Derby database. I am using Hibernate with JPA. Problem is related (probably) to boolean columns. Each query ends with error:

org.h

4条回答
  •  既然无缘
    2021-01-13 17:27

    Downgrade didn't helped. Here is valid solution which works for me:

    import java.sql.Types;
    import org.hibernate.dialect.DerbyTenSevenDialect;
    
    public class DerbyDialect extends DerbyTenSevenDialect {
    
        public DerbyDialect() {
            // fix Derby dialect boolean data type mapping error
            registerColumnType(Types.BOOLEAN, "INTEGER");
        }
    }
    

    I guess it is better to configure 'true' and 'false' constants mapping in dialect to Derby data type, but above is good enough for now.

提交回复
热议问题