ERROR: column “XX” is of type smallint but expression is of type boolean

在代码中加入以下类,缺什么补什么。

package org.hibernate.dialect;

import java.sql.Types;

import org.hibernate.dialect.PostgreSQL9Dialect;
import org.hibernate.type.descriptor.sql.IntegerTypeDescriptor;
import org.hibernate.type.descriptor.sql.LongVarbinaryTypeDescriptor;
import org.hibernate.type.descriptor.sql.LongVarcharTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;

/**
 * @author clong
 * @date: 20200610 
 * @version 1.0
 */
public class PostgreSQL20200610Dialect extends PostgreSQL9Dialect {
	@Override
	public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
		switch (sqlTypeDescriptor.getSqlType()) {
		case Types.CLOB:
			return LongVarcharTypeDescriptor.INSTANCE;
		case Types.BLOB:
			return LongVarbinaryTypeDescriptor.INSTANCE;
		case Types.BOOLEAN:
			return IntegerTypeDescriptor.INSTANCE;
		}
		return super.remapSqlTypeDescriptor(sqlTypeDescriptor);
	}
}
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐