开发者

updating entities with hibernate if necessary

开发者 https://www.devze.com 2023-03-10 22:35 出处:网络
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 hibe

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消