This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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")
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL server Big Decimal small money hibernate question
 
Similar Threads
expected:5 but was:5.0000000
Converting BigDecimal to double
BigDecimal Contsructer Pitfall.
Hibernate Is there a corresponding Annotation for <column sql-type="NUMERIC(19,2)"/>
How to read a Date column from an Excel sheet using Apache POI