Announcement Announcement Module
Collapse
No announcement yet.
Skip bad records with StaxEventReader and an XmlBeanMarshaller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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.

    Comment


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

      Comment


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

        Comment


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

          Comment


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

            Comment

            Working...
            X