I try to create a table from hibernate annotations. I need to have a column of Double type, with the length specified like : (10,2). So SQL syntax show like:
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:
int
-precision
- (Optional) The precision for a decimal (exact numeric) column. (Applies only if a decimal column is used.)int
-scale
- (Optional) The scale for a decimal (exact numeric) column. (Applies only if a decimal column is used.)