Announcement Announcement Module
No announcement yet.
Skip bad records with StaxEventReader and an XmlBeanMarshaller Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 ?

    Thanks by advance for any kind of help !

  • #2
    In the trunk version StaxEventItemReader buffers the items instead of recreating them, which should solve your problem I suppose.


    • #3
      Thanks, I'm working on it.
      Last edited by tstebut; May 16th, 2008, 10:23 AM.


      • #4
        I'm afraid it doesn't.

        XmlAnyType from org.apache, or any XmlBean generated type have too complex equals and/or hashCode methods, which returns false all the time, and even on the same physical xml fragment.

        I'm looking for a way to manage skip conditions.

        What could I show/explain to make my problem much understandable ?


        • #5
          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.


          • #6
            Thx +++++++
            Last edited by tstebut; May 19th, 2008, 05:14 AM.