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.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

Skip bad records with StaxEventReader and an XmlBeanMarshallerPage Title Module

Skip bad records with StaxEventReader and an XmlBeanMarshaller

Las time I was trying to skip bad records with HibernateCursorItemReader but the items were just not skipped.

Actually, implemantation of equals and hashCode methods solve the problem.

But now I am using a StaxEventItemReader with an XMLBeanMarshaller as unmarshaller, and I can't implement such methods, that makes skip fail and the batch loops on the same chunk.

So I used my own list to store hashCode of toString of wrong items supposed to be skip, and use contains method at next pass...But thats badly redoing what spring batch is supposed to do.
I think the source of the problem is with equals and hashCode methods need, but how can I do this with unWritable XmlBeans Objects ?

Comment

What robert is saying is that if you buffer the items read in the reader (as the latest version of the reader does), then a comparison by reference will work, since the items themselves won't be recreated.