views:

274

answers:

1

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?

+1  A: 

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

http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html

Andrew
I didn't realize that feature existed for MySQL, that is huge!
James