We have a XML file with 100s of records. Because we don't have XSD for it, sometimes during import few records fail to import. We are using Spring (version 4) transactions. The problem we are having is, because of few incorrect records, at the end of the functions, it does not save any records in database. In other words, in order import records successfully, all records have to be "correct", otherwise none of the records would be imported and saved into database.
I understand that transaction works this way. But is there any way I can resolve this issue.
After getting records from XML file you may be sending to database using Hibernate ,Before persisting the object ,you should validate the record using Hibernate validator or write your own validator.Just Ignore invalid records.
Grow a forest with seedballs and this tiny ad:
a bit of art, as a gift, that will fit in a stocking