How to specify Double’s precision on hibernate?

The length element of the Column annotation applies only if a string-valued column is used. In your case, you should use the precision and the scale elements.

@Column(precision=10, scale=2)

Here is what the specification writes about them:

  • intprecision – (Optional) The precision for a decimal (exact
    numeric) column. (Applies only if a
    decimal column is used.)
  • intscale – (Optional) The scale for a decimal (exact numeric)
    column. (Applies only if a decimal
    column is used.)

References

  • JPA 1.0 Specification
    • Section 9.1.5 “Column Annotation”

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)