This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have created a Java Desktop Application Database Application to work on a table "prova" using PostgreSQL 8.2.5. When running the application, the "double" type columns are correctly visualized into italian format (decimal point comma), whereas the "numeric" type columns are incorrect (decimal point is not comma). When trying to insert a new row I can't use the comma as a decimal point, but I have to use the decimal point. When trying to enter a character in a "date" type column I get the error: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException Connection parameters are Basic settings Name PostgreSQL Driver org.postgresql.Driver Database URL jdbc:postgresql://localhost:5432/test User Name postgres Advanced Select schema public The steps to create the application are New Project Java Desktop Application Database Application Database Connection jdbc:postgresql://localhost:5432/test [postgres on public] Database Table prova All columns included SQL scripts are CREATE TABLE prova ( id serial NOT NULL, stringa character varying, carattere character(1), doppia double precision, numero numeric(10,2), data date, timemod timestamp without time zone, CONSTRAINT prova_pkey PRIMARY KEY (id) ) WITHOUT OIDS; ALTER TABLE prova OWNER TO postgres;
Created attachment 53175 [details] error trace
Created attachment 53176 [details] Screenshot
reassign to form
The generated application is using the default converters of Beans Binding library and renderers of Swing. The "double" column is translated to Double property of Prova class. JTable is using JTable$DoubleRenderer to render double values. This renderer is using NumberFormat, therefore it handles decimal separators correctly. The "numeric" column is translated to BigDecimal property of Prova.class. JTable is using JTable$NumberRenderer to render BigDecimals. This renderer doesn't use any formatter, it uses toString(), therefore it doesn't handle decimal separators correctly. Finally the ClassCastException is caused by the fact that Beans Binding library doesn't have converter between String and Date. It is up to user to provide its own (using JTable customizer - see Table Contents action in contextual menu of JTable component). This situation is not ideal. Hence, we plan to provide a better support in this area, see issue 105147. *** This issue has been marked as a duplicate of 105147 ***