Reputation: 15
Is there any way to generate a Decimal(9,2) from Hibernate ? Right now I do it manually in the MySql database myself. IN the hibernate class I just use double.
Upvotes: 0
Views: 1121
Reputation: 1062
You can use the @Column
annotation like this:
class Product {
...
@Column(name="cost", precision=9, scale=2)
private BigDecimal cost;
...
}
Check out https://docs.jboss.org/hibernate/jpa/2.1/api/javax/persistence/Column.html for more information.
Upvotes: 1