0
public void getPersons()
{
Session s = sessionFactory.openSession();
Criteria c = s.createCriteria(Person.class);
c.add(Restrictions.isNotNull("id"));
List<Person> al = c.list();
StringWriter writer = new StringWriter();
CSVWriter csvWriter = new CSVWriter(writer, ',', '\'');
for (Person person : al) {
System.out.println(person.getName()+"------------------"+al);
csvWriter.writeAll(person); // this also not work
}
方法來讀取數據,並以CSV。什麼我應該在這裏使用創建?通過使用csvWriter.writeAll()要創建「」 seprated文件 方法writeAll(名單)類型CSVWriter不適用於參數(Person)在ahaving問題,而使用csvwriter