I want to export an entity class to csv, but when I use the below code, I manage to export only the fields of the child class while the parent's attributes are missing. Is there any restriction? I use opencsv 4.1.
ColumnPositionMappingStrategy<MyEntity> mappingStrategy = new ColumnPositionMappingStrategy<MyEntity>();
// Set mappingStrategy type to MyEntity
mappingStrategy.setType(MyEntity.class);
StatefulBeanToCsvBuilder<MyEntity> builder = new StatefulBeanToCsvBuilder<ActiveSubstance>(writer);
StatefulBeanToCsv<MyEntity> beanWriter = builder.withMappingStrategy(mappingStrategy).build();
// Writing data to csv file
beanWriter.write(entries);
writer.close();
Could you please help me?
Thank you in advance.
ColumnPositionMappingStrategy<MyEntity> mappingStrategy = new ColumnPositionMappingStrategy<MyEntity>();
// Set mappingStrategy type to MyEntity
mappingStrategy.setType(MyEntity.class);
StatefulBeanToCsvBuilder<MyEntity> builder = new StatefulBeanToCsvBuilder<ActiveSubstance>(writer);
StatefulBeanToCsv<MyEntity> beanWriter = builder.withMappingStrategy(mappingStrategy).build();
// Writing data to csv file
beanWriter.write(entries);
writer.close();
Could you please help me?
Thank you in advance.