0

I have a scenario where i have to persist an object called DummyObject which has list of OtherObject.

public class DummyObject{

private List<OtherObject> firstOtherObjectList;

private List<OtherObject> secondOtherObjectList;

private String id;

private boolean isCustomer;

private String voiceStatus;

}

public Class OtherObject{

 private String custId;

private String custName;

private String custDepartment;

}

I have posted some dummy classes. In the scenario like above, can i use ItemPreparedStatementSetter or ItemWriter or is there some other spring provided interface that i can use to persist the Dummy Object with list of OtherObject. Which is the best way and how can i implement the above scenario?

mamian
  • 66
  • 5
user9232119
  • 271
  • 1
  • 2
  • 6

1 Answers1

0

ItemPreparedStatementSetter is a strategy interface to set parameter values on a given java.sql.PreparedStatement from the current item. I'm not sure it the best option in your case.

You need to figure out how to persist such an object outside of Spring Batch first. If you use JPA/Hibernate and have already defined your O/R mapping, you can use the JpaItemWriter or HibernateItemWriter. If you don't use JPA/Hibernate and you have some kind of service that lets you persist this type of object, then you can use the ItemWriterAdapter to adapt this service to the ItemWriter interface.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50