使用JPA和Hibernate进行批量处理的最佳方式(2)

执行以前的测试用例时,Hibernate生成2个SQL INSERT语句:

INSERT INTO post (title, id) values (?, ?)"], Params:[     (Post 1, 1), (Post 2, 2), (Post 3, 3),     (Post 4, 4), (Post 5, 5), (Post 6, 6),     (Post 7, 7), (Post 8, 8), (Post 9, 9),     (Post 10, 10), (Post 11, 11), (Post 12, 12),     (Post 13, 13), (Post 14, 14), (Post 15, 15),     (Post 16, 16), (Post 17, 17), (Post 18, 18),     (Post 19, 19), (Post 20, 20), (Post 21, 21),     (Post 22, 22), (Post 23, 23), (Post 24, 24),     (Post 25, 25) ]   INSERT INTO post (title, id) values (?, ?)"], Params:[     (Post 26, 26), (Post 27, 27), (Post 28, 28),     (Post 29, 29), (Post 30, 30), (Post 31, 31),     (Post 32, 32), (Post 33, 33), (Post 34, 34),     (Post 35, 35), (Post 36, 36), (Post 37, 37),     (Post 38, 38), (Post 39, 39), (Post 40, 40),     (Post 41, 41), (Post 42, 42), (Post 43, 43),     (Post 44, 44), (Post 45, 45), (Post 46, 46),     (Post 47, 47), (Post 48, 48), (Post 49, 49),     (Post 50, 50) ] 结论

了解如何正确设计批处理作业在开发企业应用程序时非常重要。 幸运的是,使用JPA和Hibernate,这个任务很容易实现。 最重要的方面是考虑到如何让关系数据库工作效果最好,这就是驱动数据访问设计决策的因素。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/96c80de6cdedc7d31711c530c31bd3c4.html