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