updating entities with hibernate if necessary
i've got the following situation: a user uploads a csv file. every line in the csv fi开发者_运维技巧le is an entity. i parse the file and create thousands of enitities which i save in the DB via hibernate. now it can be possible, that the user changes for example 3 entries on the csv file, but loads the whole file up. that means, for example 9.997 entries are equals and only 3 are different. what's the best way via hibernate to update the data?
i hope that anybody can help me please.
thx very much in advance, simon
If you have a unique identifier and use update
/ merge
, then hibernate won't create new records.
精彩评论