This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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: 521
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: 521
Fixed I added @Column(name="advanced_payment",columnDefinition="smallmoney")
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: SQL server Big Decimal small money hibernate question
 
Similar Threads
BigDecimal Contsructer Pitfall.
Converting BigDecimal to double
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
expected:5 but was:5.0000000