spring - Ask about how to insert data into many tables (with relationship) and avoid duplicate data error -


currently i'm developing application import data xml mysql using spring batch ( https://github.com/samuelwilsone/filmdata ).

this first time i'm working spring batch please guide me how resolve problems below:

i have 5 tables (actors, directors, films, film_actors, film_directors). each director can have more 1 film, want implement program insert new director "directors" table , id use insert "film_directors" table. if director has existed, program id , insert "film_directors" table. actor similar.

example:

with 2 files (avatar.xml, titanic.xml), want insert database this:

--- table "films": avatar, avatar 2009, 7.9 titanic, titanic 1997, 7.7  --- table "director": 1, james cameron  --- table "film_directors": avatar, 1 titanic, 1 

when run program in second time, error because duplicate data (data existed in database). how can avoid this?

i'm appreciated help.

why error, if datas exeist in database, skip rows ok, import success


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -