I have a hibernation mapping as follows:
<hibernate-mapping> <class name="kochman.elie.data.types.InvoiceTVO" table="INVOICE"> <id name="id" column="ID"> <generator class="increment"/> </id> <property name="date" column="INVOICE_DATE"/> <property name="customerId" column="CUSTOMER_ID"/> <property name="schoolId" column="SCHOOL_ID"/> <property name="bookFee" column="BOOK_FEE"/> <property name="adminFee" column="ADMIN_FEE"/> <property name="totalFee" column="TOTAL_FEE"/> </class> </hibernate-mapping>
where InvoiceTVO has variables defined as:
private int id; private Date date; private int customerId; private int schoolId; private float bookFee; private float adminFee; private float totalFee;
When I insert into this table, I get the following error:
Hibernate: insert into INVOICE (INVOICE_DATE, CUSTOMER_ID, SCHOOL_ID, BOOK_FEE, ADMIN_FEE, TOTAL_FEE, ID) values (?, ?, ?, ?, ?, ?, ?) 50156 [AWT-EventQueue-0] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22001 50156 [AWT-EventQueue-0] ERROR org.hibernate.util.JDBCExceptionReporter - Data truncation: Data truncated for column 'ADMIN_FEE' at row 1 50156 [AWT-EventQueue-0] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
I tried changing the adminFee type to double, and that didn't work either. The problem is that Hibernate actually inserted the insert correctly, and future selection operators work to return the current set of values, but this error prevents me from further processing this account.
The fields bookFee, adminFee, and totalFee must be currencies. They are defined in the MySQL database as decimal (5,2).
Any help on how to resolve this would be greatly appreciated.