我已經在我的postgresql數據庫中定義了一個列作爲貨幣類型,比方說總數。 我將用JAVA的JSpinner數據採用雙模式,插入完成只是完美的,但是當我想用Postgresql的錢類型和java
result.getBigDecimal("total");
選擇存儲在總列中的數據我得到了一個錯誤;
org.postgresql.util.PSQLException: Mauvaise valeur pour le type BigDecimal : 0,00 €
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toBigDecimal(AbstractJdbc2ResultSet.java:3012)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:2400)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:355)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:361)
at DAO.BonDachatDAO.findAll(BonDachatDAO.java:42)
at VIEW.BonDeAchatUi.initComponents(BonDeAchatUi.java:255)
at VIEW.BonDeAchatUi.<init>(BonDeAchatUi.java:123)
at VIEW.BonDeAchatUi$3.run(BonDeAchatUi.java:483)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
事情是,在這種情況下,查詢實際上返回'0,00€',即包括歐元符號 - 或根據lc_monetary設置的本地等價物。 – fvu