-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
这个类不能起到效果
public class PowerJobPGDialect extends PostgreSQL10Dialect {
/**
* 使用 {@link Types#LONGVARCHAR} 覆盖 {@link Types#CLOB} 类型
*
* 注意,如果在 PG 库创建表时使用的列类型为 oid ,那么这样会导致没法正确读取数据
* 在 PowerJob 中能这样用是因为 PowerJob 的所有实体类中被 @Lob 注解标记的列对应数据库中的字段类型都是 text
* 另外还需要注意数据库版本,如果是 10.x 以前的,需自行提供一个合适的 Dialect 类(选择合适的版本继承)
*
* 更多内容请关注该 issues:https://github.com/PowerJob/PowerJob/issues/153
*/
@Override
public SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
return Types.CLOB == sqlCode ? LongVarcharTypeDescriptor.INSTANCE : null;
}
}
解决方法:
重写一个类,使用配置文件指定全限定名路径来激活
public class AdpPostgreSQLDialect extends PostgreSQL10Dialect {
public AdpPostgreSQLDialect() {
super();
registerColumnType(Types.BLOB, "bytea");
registerColumnType(Types.CLOB, "text");
}
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
switch (sqlTypeDescriptor.getSqlType()) {
case Types.CLOB:
return LongVarcharTypeDescriptor.INSTANCE;
case Types.BLOB:
return LongVarbinaryTypeDescriptor.INSTANCE;
case Types.NCLOB:
return LongVarbinaryTypeDescriptor.INSTANCE;
}
return super.remapSqlTypeDescriptor(sqlTypeDescriptor);
}
}
这个什么时候可以更新到版本中去?还是我自己本地打包自己用?
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested