开发者

Elegant way to handle upsert with Hibernate and MySQL

I'm currently working on a batch import feature that sits on top of Hibernate and MySQL. My goal is to have Upsert functionality for several tables. I'm finding myself writing a lot of code to deal with seeing if the row exists by key and branching to right method. I was wondering if there might be a better way, i.e. something analogous to the tools that开发者_运维技巧 come with SQL-Server SSIS but for Hibernate and MySQL. What tools or elegant solutions have you used to handle bulk Upserts with hibernate and/or MySQL?


You might look into MySQL's ON DUPLICATE KEY UPDATE feature:

https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜