For a DB there are 4 columns that represent numbers:
col1 type: NUMBER(38)
col2 type: NUMBER(18)
col3 type: NUMBER(10,2)
In Spring JPA should I map these columns to Float
or Double
?
@Column(name = "col1")
private Double col1
@Column(name = "col2")
private Double col2
@Column(name = "col3")
private Double col3
or
@Column(name = "col1")
private Float col1
@Column(name = "col2")
private Float col2
@Column(name = "col3")
private Float
Is it redundant to use Double as each number type
col1 type: NUMBER(38)
col2 type: NUMBER(18)
col3 type: NUMBER(10,2)
can be mapped to float without loss of precision ?
Update:
For NUMBER(38) should be ? :
@Column(precision=38, scale=0)
For NUMBER(10,2) should be ? :
@Column(precision=10, scale=2)