This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Comment

It is not an issue, It is something I do not know what to do and how to generate, I found a way to do so by manually, not using StaxEventItemWriter, Just using Jaxb2Marshaller and marshall by myself. It worked well.

I'd still be interested in seeing your configuration. The XML you require should not be an issue to generate with the off the shelf components. Also, keep in mind the writer you posted above does not handle things like retry or restart.

Ahhh...what is the type that is being sent to the StaxEventItemWriter? To generate the output you require, I would expect the item to be of type Transaction with a collection of Return objects in it (along with the other attributes required) instead of the just the Return you are returning from the ItemProcessor. If you structure the job that way, it should work with the default configurations.

Comment

Ahhh...what is the type that is being sent to the StaxEventItemWriter? To generate the output you require, I would expect the item to be of type Transaction with a collection of Return objects in it (along with the other attributes required) instead of the just the Return you are returning from the ItemProcessor. If you structure the job that way, it should work with the default configurations.

Comment

"To generate the output you require, I would expect the item to be of type Transaction with a collection of Return objects in it"
That is exactly right, BUT batch job does not allow this, because I am processing Return type in one time, so batch job will call StaxEventItemWriter with List<? extends Return> param type.
If I want to use Transaction type for StaxEventItemWriter, then My processor should return Transaction type, But I have only one transaction object. This is the exact the problem. Sorry man for not giving the answers that you are looking for.