Hibernate: Found: float, expected: double precision

前端 未结 8 1314
清歌不尽
清歌不尽 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:54

    If you are using Annotation method, you need to declare column type as below for the field.

    @Column(name = "PERFORMANCE", columnDefinition = "FLOAT(5,2)")
    private double performance;
    
    0 讨论(0)
  • 2020-12-16 21:58

    application.properties

    hibernate.dialect=com.test.config.Oracle10gDialectExtended

    create class

    package com.test.config;
    
    import java.sql.Types;
    
    import org.hibernate.dialect.Oracle10gDialect;
    
    public class Oracle10gDialectExtended extends Oracle10gDialect {
    
        public Oracle10gDialectExtended() {
            registerColumnType(Types.DOUBLE, "float");
        }
    }
    
    0 讨论(0)
提交回复
热议问题