wood burning stoves 2.0*
The moose likes JDBC and the fly likes SQL server Big Decimal small money hibernate question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL server Big Decimal small money hibernate question" Watch "SQL server Big Decimal small money hibernate question" New topic
Author

SQL server Big Decimal small money hibernate question

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
I have a table which has a column advanced_payment which is sql server small money.

In my java code I have

@Column(name="advanced_payment")
private BigDecimal advancedPayment;

This calls the following hibernateException


Caused by: org.hibernate.HibernateException: Wrong column type in Enterprise.dbo.pws_price_profile for column advanced_payment. Found:
smallmoney, expected: numeric(19,2).

numeric(19,2) is BigDecimal in Oracle. SQL Server maps Big Decimal to small money.

So is this a hibernate problem.

Thanks for any help

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
Fixed I added @Column(name="advanced_payment",columnDefinition="smallmoney")
 
Don't get me started about those stupid light bulbs.
 
subject: SQL server Big Decimal small money hibernate question
 
Similar Threads
BigDecimal Contsructer Pitfall.
Hibernate Is there a corresponding Annotation for <column sql-type="NUMERIC(19,2)"/>
expected:5 but was:5.0000000
How to read a Date column from an Excel sheet using Apache POI
Converting BigDecimal to double