Hibernate: Found: float, expected: double precision

前端 未结 8 1312
清歌不尽
清歌不尽 2020-12-16 21:28

I have a problem with the mapping of Oracle Float double precision datatype to Java Double datatype. The hibernate schema validator seems to fail when the Java Double dataty

8条回答
  •  时光说笑
    2020-12-16 21:36

    Unless you define a column type as double precision in DDL file, Oracle will convert it to float column type. So you need to register double as float column type in dialect class.

    public class Oracle10gDialectExtended extends Oracle10gDialect {
    
        public Oracle10gDialectExtended() {
            super();
            registerColumnType(Types.DOUBLE, "float");
        }
    }
    

    Finally register Oracle10gDialectExtended in Hibernate/JPA configuration as hibernate.dialect.

提交回复
热议问题