Using the bean function to map the fields, I was hoping there would be some
example on how to work with dates.
My csv file date looks like this: 12-Jan-2009 00:00:00
My bean class has a field java.sql.Timestamp
When I do the List<App_request_extract> list = csv.parse(strat, reader); I
get an error that it could not map the value. I removed the date from the
extract and the bean, then the csv.parse worked beautifully.
I am probably missing something obvious. Do I have to override a method or
set something in the Mapping Strategy?
CSVReader reader = new CSVReader(new BufferedReader(new
FileReader("extract.csv")), '|', CSVWriter.NO_QUOTE_CHARACTER);
HeaderColumnNameMappingStrategy<App_request_extract> strat = new
HeaderColumnNameMappingStrategy<App_request_extract>();
strat.setType(App_request_extract.class);
CsvToBean<App_request_extract> csv = new
CsvToBean<App_request_extract>();
List<App_request_extract> list = csv.parse(strat, reader);
Nobody/Anonymous
None
None
Public
|
Date: 2009-12-10 12:59 Added Feature request 2911984 which is a more generic version of 2892681 |
|
Date: 2009-10-27 21:00 Sure. |
|
Date: 2009-10-21 13:53 Could you please attach the following. |
| Filename | Description | Download |
|---|---|---|
| TestExtract.java | runnable class | Download |
| lawson_extract.csv | csv test data | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| close_date | - | 2009-12-10 12:59 | sconway |
| allow_comments | 1 | 2009-12-10 12:59 | sconway |
| status_id | Open | 2009-12-10 12:59 | sconway |
| File Added | 348445: lawson_extract.csv | 2009-10-27 21:02 | trames |
| File Added | 348444: TestExtract.java | 2009-10-27 21:01 | trames |
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use