{"id":1621,"date":"2025-05-22T09:31:09","date_gmt":"2025-05-22T00:31:09","guid":{"rendered":"https:\/\/route-zero.com\/recruit\/?post_type=route&#038;p=1621"},"modified":"2025-09-22T09:31:57","modified_gmt":"2025-09-22T00:31:57","slug":"spring-boot%e3%81%a7list%e6%9b%b4%e6%96%b0%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95%ef%bd%9cfor%e6%96%87%e3%83%bbstream%e3%83%bbsave-saveall%e3%81%ae%e9%81%95%e3%81%84%e3%82%92%e5%be%b9%e5%ba%95%e8%a7%a3","status":"publish","type":"route","link":"https:\/\/route-zero.com\/recruit\/route\/1621\/","title":{"rendered":"Spring Boot\u3067List\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff5cfor\u6587\u30fbStream\u30fbsave\/saveAll\u306e\u9055\u3044\u3092\u5fb9\u5e95\u89e3\u8aac"},"content":{"rendered":"<div>\n<h1>Spring Boot\u3067List\u30921\u4ef6\u305a\u3064\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff5c\u521d\u5fc3\u8005\u3067\u3082\u308f\u304b\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u4ed8\u304d<\/h1>\n<hr \/>\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>\n    Spring Boot\u3067\u958b\u767a\u3057\u3066\u3044\u308b\u3068\u3001<strong>List\u306e\u4e2d\u8eab\u30921\u4ef6\u305a\u3064\u66f4\u65b0\u3057\u305f\u3044<\/strong>\u5834\u9762\u306b\u3057\u3070\u3057\u3070\u76f4\u9762\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u53d6\u5f97\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u3092\u52a0\u5de5\u3057\u3066\u518d\u4fdd\u5b58\u3059\u308b\u3068\u304d\u3084\u3001\u5916\u90e8API\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6574\u5f62\u3059\u308b\u3068\u304d\u3067\u3059\u3002\u3057\u304b\u3057\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u6bb5\u968e\u306b\u306a\u308b\u3068\u3001\u300cfor\u6587\u3067\u30eb\u30fc\u30d7\u3059\u308b\u306e\u304c\u6700\u9069\u306a\u306e\u304b\u300d\u300cStream\u3067\u66f8\u3051\u3070\u30b9\u30de\u30fc\u30c8\u306a\u306e\u304b\u300d\u300c\u66f4\u65b0\u6642\u306b<code>save<\/code>\u3068<code>saveAll<\/code>\u3092\u3069\u3046\u4f7f\u3044\u5206\u3051\u308b\u3079\u304d\u304b\u300d\u3068\u8ff7\u3046\u3053\u3068\u3082\u591a\u3044\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\n  <\/p>\n<p>\n    \u672c\u8a18\u4e8b\u3067\u306f\u3001Spring Boot\u306b\u304a\u3051\u308b<code>List<\/code>\u66f4\u65b0\u306e\u57fa\u672c\u304b\u3089\u3001\u4ee3\u8868\u7684\u306a\u5b9f\u88c5\u65b9\u6cd5\uff08for-each\uff0fStream\uff0fIterator\uff0fsave\uff0fsaveAll\uff09\u306e\u6bd4\u8f03\u3001\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u306e\u56de\u907f\u65b9\u6cd5\u3001\u3055\u3089\u306b\u5b9f\u52d9\u3067\u5f79\u7acb\u3064\u8003\u3048\u65b9\u307e\u3067\u3092\u6574\u7406\u3057\u307e\u3059\u3002\u8aad\u4e86\u5f8c\u306b\u306f\u5358\u306a\u308b\u30b3\u30fc\u30c9\u4f8b\u3060\u3051\u3067\u306a\u304f\u3001<strong>\u306a\u305c\u305d\u306e\u65b9\u6cd5\u3092\u9078\u3076\u306e\u304b<\/strong>\u307e\u3067\u7406\u89e3\u3067\u304d\u3001\u81ea\u4fe1\u3092\u6301\u3063\u3066\u5b9f\u88c5\u306b\u81e8\u3081\u308b\u3088\u3046\u306b\u306a\u308b\u306f\u305a\u3067\u3059\u3002\n  <\/p>\n<hr \/>\n<h2>Spring Boot\u3067List\u30921\u4ef6\u305a\u3064\u66f4\u65b0\u3059\u308b\u57fa\u672c<\/h2>\n<h3>\u3088\u304f\u3042\u308b\u5229\u7528\u30b7\u30fc\u30f3<\/h3>\n<ul>\n<li>\n<p><strong>DB\u66f4\u65b0<\/strong>\uff1a\u53d6\u5f97\u3057\u305f\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u306e\u7279\u5b9a\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u52a0\u5de5\u3057\u3066\u4fdd\u5b58<\/p>\n<\/li>\n<li>\n<p><strong>API\u30ec\u30b9\u30dd\u30f3\u30b9\u52a0\u5de5<\/strong>\uff1a\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u306e\u30c7\u30fc\u30bf\u3092\u6574\u5f62\u3057\u3066\u8fd4\u5374<\/p>\n<\/li>\n<li>\n<p><strong>\u30d0\u30c3\u30c1\u51e6\u7406<\/strong>\uff1a\u5927\u91cf\u30c7\u30fc\u30bf\u3092\u30eb\u30fc\u30eb\u306b\u6cbf\u3063\u3066\u9010\u6b21\u66f4\u65b0<\/p>\n<\/li>\n<\/ul>\n<p>\u300c\u307e\u3068\u3081\u3066\u66f4\u65b0\u300d\u3088\u308a\u300c\u6761\u4ef6\u4ed8\u304d\u30671\u4ef6\u305a\u3064\u66f4\u65b0\u300d\u304c\u73fe\u5834\u3067\u306f\u591a\u304f\u3001\u30eb\u30fc\u30d7\u51e6\u7406\u306e\u7406\u89e3\u304c\u6b20\u304b\u305b\u307e\u305b\u3093\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aList\uff08\u30ea\u30b9\u30c8\uff09<\/strong><br \/>\n      Java\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u578b\u306e\u3072\u3068\u3064\u3002\u8907\u6570\u306e\u30c7\u30fc\u30bf\uff08\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3092\u9806\u756a\u306b\u683c\u7d0d\u3067\u304d\u3001for\u6587\u3084Stream\u3067\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u53ef\u80fd\u3067\u3059\u3002\n    <\/p>\n<\/blockquote>\n<h3>for\u6587\u306b\u3088\u308b\u57fa\u672c\u5b9f\u88c5\u4f8b<\/h3>\n<pre><code>for (User user : userList) {\r\n    if (\"ACTIVE\".equals(user.getStatus())) {\r\n        user.setPoint(user.getPoint() + 10);\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u76f4\u611f\u7684\u3002\u5c0f\u898f\u6a21\u51e6\u7406\u3084\u521d\u5fc3\u8005\u306b\u306f\u6700\u9069\u3067\u3059\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1afor\u6587<\/strong><br \/>\n      \u6307\u5b9a\u3057\u305f\u56de\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u69cb\u6587\u3002List\u306e\u5404\u8981\u7d20\u306b\u9806\u756a\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\n    <\/p>\n<\/blockquote>\n<p>for\u6587\u3068Stream\u306e\u4f7f\u3044\u5206\u3051\u3084\u66f8\u304d\u63db\u3048\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1138\/\">Java\u306efor\u6587\u3092Stream\u306b\u66f8\u304d\u63db\u3048\u308b\u306b\u306f\uff1fSpring Boot\u3067\u306e\u5b9f\u8df5\u4f8b\u4ed8\u304d\u3067\u308f\u304b\u308b\uff01<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>Stream\u3092\u4f7f\u3063\u305f\u5b9f\u88c5\u4f8b<\/h3>\n<pre><code>userList.stream()\r\n        .filter(user -> \"ACTIVE\".equals(user.getStatus()))\r\n        .forEach(user -> user.setPoint(user.getPoint() + 10));\r\n<\/code><\/pre>\n<p>\u5ba3\u8a00\u7684\u3067\u30b9\u30c3\u30ad\u30ea\u66f8\u3051\u307e\u3059\u304c\u3001\u526f\u4f5c\u7528\u3092\u4f34\u3046\u305f\u3081\u30c1\u30fc\u30e0\u898f\u7d04\u306b\u3088\u3063\u3066\u306f\u656c\u9060\u3055\u308c\u308b\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aStream<\/strong><br \/>\n      Java8\u4ee5\u964d\u3067\u5c0e\u5165\u3055\u308c\u305f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u64cd\u4f5c\u306e\u4ed5\u7d44\u307f\u3002filter\u3084forEach\u306a\u3069\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3001\u30c7\u30fc\u30bf\u306e\u7d5e\u308a\u8fbc\u307f\u3084\u51e6\u7406\u3092\u7c21\u6f54\u306b\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002\n    <\/p>\n<\/blockquote>\n<hr \/>\n<h2>JPA\u306esave \/ saveAll\u3092\u4f7f\u3063\u305f\u66f4\u65b0<\/h2>\n<p>Spring Data JPA\u3067\u306f\u3001\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u306e\u4fdd\u5b58\u306b<code>save<\/code>\u3068<code>saveAll<\/code>\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aJPA\uff08Java Persistence API\uff09<\/strong><br \/>\n      Java\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u3092\u7c21\u5358\u306b\u884c\u3046\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3002\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\uff08\u30c7\u30fc\u30bf\u306e\u8a2d\u8a08\u56f3\uff09\u3092\u4f7f\u3063\u3066\u3001DB\u306e\u4fdd\u5b58\u30fb\u53d6\u5f97\u30fb\u66f4\u65b0\u3092\u884c\u3044\u307e\u3059\u3002\n    <\/p>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1asave \/ saveAll<\/strong><br \/>\n      save\u306f1\u4ef6\u305a\u3064\u3001saveAll\u306f\u8907\u6570\u4ef6\u307e\u3068\u3081\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u30fb\u66f4\u65b0\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002\n    <\/p>\n<\/blockquote>\n<p>JPA\u3068JDBC\u306e\u4f7f\u3044\u5206\u3051\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1264\/\">\u3010\u4fdd\u5b58\u7248\u3011JPA vs JDBC\u2502Spring Boot\u3067\u306e\u5b9f\u52d9\u7684\u306a\u4f7f\u3044\u5206\u3051\u3068\u5c0e\u5165\u5224\u65ad\u30ac\u30a4\u30c9<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u3067\u4f7f\u3046User\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3068Repository<\/h3>\n<pre><code>\/\/ User.java\r\nimport jakarta.persistence.*;\r\n@Entity\r\n@Table(name = \"users\")\r\npublic class User {\r\n    @Id\r\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\r\n    private Long id;\r\n    private String name;\r\n    private String status;\r\n    private int point;\r\n    \/\/ getter \/ setter ...\r\n}\r\n<\/code><\/pre>\n<pre><code>\/\/ UserRepository.java\r\nimport org.springframework.data.jpa.repository.JpaRepository;\r\n    public interface UserRepository extends JpaRepository&lt;User, Long&gt; {\r\n}\r\n<\/code><\/pre>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u306f\u6b21\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u4eee\u5b9a\u3057\u307e\u3059\uff1a<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aEntity\uff08\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\uff09<\/strong><br \/>\n      \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u69cb\u9020\u3092Java\u30af\u30e9\u30b9\u3067\u8868\u73fe\u3057\u305f\u3082\u306e\u3002@Entity\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u5b9a\u7fa9\u3057\u307e\u3059\u3002\n    <\/p>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aRepository\uff08\u30ea\u30dd\u30b8\u30c8\u30ea\uff09<\/strong><br \/>\n      \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\uff08\u4fdd\u5b58\u30fb\u53d6\u5f97\u30fb\u66f4\u65b0\uff09\u3092\u62c5\u5f53\u3059\u308b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3002Spring Data JPA\u3067\u81ea\u52d5\u751f\u6210\u3055\u308c\u307e\u3059\u3002\n    <\/p>\n<\/blockquote>\n<p>List\u578b\u3084Map\u578b\u306e\u9055\u3044\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1100\/\">\u3010Spring Boot\u5b9f\u8df5\u30ac\u30a4\u30c9\u3011List\u578b\u30fbMap\u578b\u306e\u9055\u3044\u3068Bean\u30af\u30e9\u30b9\u306e\u57fa\u790e\uff06\u5fdc\u7528<\/a>\u300f\u3082\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>id<\/th>\n<th>name<\/th>\n<th>status<\/th>\n<th>point<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Alice<\/td>\n<td>ACTIVE<\/td>\n<td>100<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Bob<\/td>\n<td>INACTIVE<\/td>\n<td>50<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Carol<\/td>\n<td>ACTIVE<\/td>\n<td>70<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>save\uff081\u4ef6\u305a\u3064\u66f4\u65b0\uff09<\/h3>\n<pre><code>List&lt;User&gt; userList = userRepository.findAll();\r\nfor (User user : userList) {\r\n    if (\"ACTIVE\".equals(user.getStatus())) {\r\n        user.setPoint(user.getPoint() + 10);\r\n        userRepository.save(user); \/\/ 1\u4ef6\u3054\u3068\u306b\u66f4\u65b0\r\n    }\r\n}\r\n<\/code><\/pre>\n<p><strong>\u7279\u5fb4<\/strong><\/p>\n<ul>\n<li>\u5358\u7d14\u3067\u308f\u304b\u308a\u3084\u3059\u3044\u3002<\/li>\n<li>\u66f4\u65b0\u4ef6\u6570\u304c\u591a\u3044\u3068SQL\u304c1\u4ef6\u305a\u3064\u767a\u884c\u3055\u308c\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u4f4e\u4e0b\u306e\u539f\u56e0\u306b\u306a\u308b\u3002<\/li>\n<\/ul>\n<h3>saveAll\uff08\u307e\u3068\u3081\u3066\u66f4\u65b0\uff09<\/h3>\n<pre><code>List&lt;User&gt; userList = userRepository.findAll();\r\nList&lt;User&gt; updatedUsers = userList.stream()\r\n        .peek(user -> {\r\n            if (\"ACTIVE\".equals(user.getStatus())) {\r\n                user.setPoint(user.getPoint() + 10);\r\n            }\r\n        })\r\n        .toList();\r\nuserRepository.saveAll(updatedUsers); \/\/ \u4e00\u62ec\u66f4\u65b0\r\n<\/code><\/pre>\n<p><strong>\u7279\u5fb4<\/strong><\/p>\n<ul>\n<li>\u8907\u6570\u4ef6\u3092\u4e00\u62ec\u3067\u66f4\u65b0\u3067\u304d\u308b\u305f\u3081\u52b9\u7387\u7684\u3002<\/li>\n<li>\u5185\u90e8\u7684\u306b\u306f\u30d0\u30c3\u30c1\u7684\u306bINSERT\/UPDATE\u304c\u767a\u884c\u3055\u308c\u308b\u3002<\/li>\n<li>\u5927\u91cf\u66f4\u65b0\u6642\u306b\u6709\u52b9\u3002<\/li>\n<\/ul>\n<h3>\u51e6\u7406\u524d\u5f8c\u306e\u30a4\u30e1\u30fc\u30b8<\/h3>\n<p>\u51e6\u7406\u524d\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>id<\/th>\n<th>name<\/th>\n<th>status<\/th>\n<th>point<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Alice<\/td>\n<td>ACTIVE<\/td>\n<td>100<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Bob<\/td>\n<td>INACTIVE<\/td>\n<td>50<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Carol<\/td>\n<td>ACTIVE<\/td>\n<td>70<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u51e6\u7406\u5f8c\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>id<\/th>\n<th>name<\/th>\n<th>status<\/th>\n<th>point<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>Alice<\/td>\n<td>ACTIVE<\/td>\n<td>110<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Bob<\/td>\n<td>INACTIVE<\/td>\n<td>50<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Carol<\/td>\n<td>ACTIVE<\/td>\n<td>80<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4f7f\u3044\u5206\u3051\u306e\u76ee\u5b89<\/h3>\n<ul>\n<li><strong>\u5c11\u91cf\u66f4\u65b0 or \u6761\u4ef6\u304c\u8907\u96d1<\/strong> \u2192 <code>save<\/code><\/li>\n<li><strong>\u5927\u91cf\u66f4\u65b0 or \u5358\u7d14\u306a\u5909\u66f4\u51e6\u7406<\/strong> \u2192 <code>saveAll<\/code><\/li>\n<\/ul>\n<hr \/>\n<h2>\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u3068\u56de\u907f\u65b9\u6cd5<\/h2>\n<h3>ConcurrentModificationException<\/h3>\n<p>\u30eb\u30fc\u30d7\u4e2d\u306b\u76f4\u63a5\u524a\u9664\u3059\u308b\u3068\u767a\u751f\u3002 \u2192 <code>Iterator.remove()<\/code>\u3092\u5229\u7528\u3057\u3066\u56de\u907f\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aIterator\uff08\u30a4\u30c6\u30ec\u30fc\u30bf\uff09<\/strong><br \/>\n      \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u8981\u7d20\u3092\u9806\u756a\u306b\u53d6\u308a\u51fa\u3059\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3002remove\u30e1\u30bd\u30c3\u30c9\u3067\u5b89\u5168\u306b\u8981\u7d20\u524a\u9664\u304c\u3067\u304d\u307e\u3059\u3002\n    <\/p>\n<\/blockquote>\n<h3>null\u30c1\u30a7\u30c3\u30af\u30fbOptional\u6d3b\u7528<\/h3>\n<p>API\u30ec\u30b9\u30dd\u30f3\u30b9\u3084DB\u53d6\u5f97\u5024\u304c<code>null<\/code>\u306b\u306a\u308b\u30b1\u30fc\u30b9\u3067\u306f<code>Optional.ofNullable()<\/code>\u3084<code>Objects.nonNull()<\/code>\u3067\u5b89\u5168\u306b\u51e6\u7406\u3059\u308b\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1aOptional\uff08\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\uff09<\/strong><br \/>\n      null\u5024\u306b\u3088\u308b\u4f8b\u5916\u3092\u9632\u3050\u305f\u3081\u306e\u30e9\u30c3\u30d1\u30fc\u30af\u30e9\u30b9\u3002\u5024\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u5b89\u5168\u306b\u5224\u5b9a\u3067\u304d\u307e\u3059\u3002\n    <\/p>\n<\/blockquote>\n<h3>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u6ce8\u610f\u70b9<\/h3>\n<p><code>save<\/code>\u3084<code>saveAll<\/code>\u306f<code>@Transactional<\/code>\u30b9\u30b3\u30fc\u30d7\u5185\u3067\u547c\u3076\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5916\u3067\u306f\u5909\u66f4\u304c\u53cd\u6620\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<blockquote>\n<p>\n      <strong>\u7528\u8a9e\u89e3\u8aac\uff1a@Transactional\uff08\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30ca\u30eb\uff09<\/strong><br \/>\n      \u8907\u6570\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u3092\u3072\u3068\u3064\u306e\u51e6\u7406\u5358\u4f4d\uff08\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\uff09\u3068\u3057\u3066\u307e\u3068\u3081\u308b\u305f\u3081\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3002\u9014\u4e2d\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3001\u3059\u3079\u3066\u306e\u5909\u66f4\u3092\u5143\u306b\u623b\u305b\u307e\u3059\u3002\n    <\/p>\n<\/blockquote>\n<p>@Transactional\u306e\u8a73\u7d30\u3084\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1302\/\">Spring Boot\u3067\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u3055\u308c\u306a\u3044\u539f\u56e0\u3068\u306f\uff1f@Transactional\u5b8c\u5168\u30ac\u30a4\u30c9<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<hr \/>\n<h2>\u5b9f\u52d9\u3067\u306e\u5fdc\u7528\u3068\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7<\/h2>\n<h3>\u30b3\u30fc\u30c9\u30ec\u30d3\u30e5\u30fc\u3067\u306e\u8aac\u660e\u529b<\/h3>\n<p>\u300c\u306a\u305csaveAll\u3092\u9078\u3093\u3060\u306e\u304b\u300d\u3092\u8aac\u660e\u3067\u304d\u308b\u3053\u3068\u306f\u30ec\u30d3\u30e5\u30fc\u3067\u8a55\u4fa1\u3055\u308c\u308b\u8981\u7d20\u3067\u3059\u3002<\/p>\n<h3>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u610f\u8b58\u3059\u308b\u7fd2\u6163<\/h3>\n<p>\u66f4\u65b0\u4ef6\u6570\u304c\u6570\u5343\u4ef6\u898f\u6a21\u3092\u8d85\u3048\u308b\u5834\u5408\u30011\u4ef6\u305a\u3064<code>save<\/code>\u3059\u308b\u3068DB\u8ca0\u8377\u304c\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u898b\u636e\u3048\u305f\u5b9f\u88c5\u9078\u629e\u306f\u4fe1\u983c\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n<h3>\u57fa\u790e\u30b9\u30ad\u30eb\u304c\u30ad\u30e3\u30ea\u30a2\u306e\u571f\u53f0\u306b<\/h3>\n<p><code>List<\/code>\u66f4\u65b0\u3084<code>save<\/code> \/ <code>saveAll<\/code>\u306e\u4f7f\u3044\u5206\u3051\u3068\u3044\u3063\u305f\u57fa\u790e\u77e5\u8b58\u306f\u3001\u73fe\u5834\u304c\u5909\u308f\u3063\u3066\u3082\u901a\u7528\u3059\u308b\u666e\u904d\u7684\u306a\u30b9\u30ad\u30eb\u3067\u3059\u3002<\/p>\n<hr \/>\n<h2>FAQ<\/h2>\n<ul>\n<li>\n<p>Spring Boot\u3067List\u3092DB\u306b\u66f4\u65b0\u3059\u308b\u306a\u3089<code>save<\/code>\u3068<code>saveAll<\/code>\u3069\u3061\u3089\u3092\u4f7f\u3046\u3079\u304d\uff1f \u2192 \u5c11\u91cf\u306a\u3089<code>save<\/code>\u3001\u5927\u91cf\u306a\u3089<code>saveAll<\/code>\u3002<\/p>\n<\/li>\n<li>\n<p>saveAll\u306f\u5185\u90e8\u3067\u3069\u3093\u306aSQL\u3092\u767a\u884c\u3057\u3066\u3044\u308b\u306e\uff1f \u2192 \u8907\u6570\u306eINSERT\/UPDATE\u3092\u307e\u3068\u3081\u3066\u767a\u884c\u3002\u5358\u4e00SQL\u306b\u306f\u306a\u3089\u306a\u3044\u3002<\/p>\n<\/li>\n<li>\n<p>save\u3067\u5927\u91cf\u66f4\u65b0\u3059\u308b\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u843d\u3061\u308b\u306e\u306f\u306a\u305c\uff1f \u2192 1\u4ef6\u305a\u3064SQL\u304c\u767a\u884c\u3055\u308c\u308b\u305f\u3081\u3002<\/p>\n<\/li>\n<li>\n<p>saveAll\u3092\u4f7f\u3063\u3066\u3082\u30d0\u30eb\u30af\u66f4\u65b0SQL\u306b\u306f\u306a\u3089\u306a\u3044\u306e\uff1f \u2192 \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u306a\u3089\u306a\u3044\u3002\u30d0\u30eb\u30af\u51e6\u7406\u304c\u5fc5\u8981\u306a\u3089<code>@Modifying<\/code>\uff0bJPQL\u3084\u30cd\u30a4\u30c6\u30a3\u30d6\u30af\u30a8\u30ea\u3092\u5229\u7528\u3002<\/p>\n<\/li>\n<li>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u5fd8\u308c\u308b\u3068\u3069\u3046\u306a\u308b\uff1f \u2192 DB\u306b\u5909\u66f4\u304c\u53cd\u6620\u3055\u308c\u306a\u3044\u5834\u5408\u304c\u3042\u308b\u3002<code>@Transactional<\/code>\u3092\u4ed8\u4e0e\u3059\u3079\u304d\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\n    Spring Boot\u306b\u304a\u3051\u308bList\u306e\u66f4\u65b0\u306f\u3001<strong>for\u6587\u30fbStream\u30fbIterator<\/strong>\u3092\u7528\u3044\u305f\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u52a0\u3048\u3066\u3001<strong>JPA\u306e<code>save<\/code> \/ <code>saveAll<\/code>\u3092\u4f7f\u3063\u305fDB\u53cd\u6620<\/strong\n    >\u3092\u3069\u3046\u4f7f\u3044\u5206\u3051\u308b\u304b\u304c\u91cd\u8981\u3067\u3059\u3002\u5c11\u91cf\u306e\u66f4\u65b0\u3067\u3042\u308c\u3070<code>save<\/code>\u3001\u5927\u91cf\u306e\u66f4\u65b0\u3067\u3042\u308c\u3070<code>saveAll<\/code>\u304c\u6709\u52b9\u3067\u3059\u3002\u307e\u305f\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u6b63\u3057\u304f\u884c\u3046\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u4e0d\u6574\u5408\u3084\u4f8b\u5916\u3092\u672a\u7136\u306b\u9632\u3052\u307e\u3059\u3002\n  <\/p>\n<p>\u6700\u7d42\u7684\u306b\u5927\u5207\u306a\u306e\u306f\u300c\u306a\u305c\u3053\u306e\u65b9\u6cd5\u3092\u9078\u3093\u3060\u306e\u304b\u300d\u3092\u8aac\u660e\u3067\u304d\u308b\u3053\u3068\u3002\u3053\u308c\u306b\u3088\u308a\u30b3\u30fc\u30c9\u30ec\u30d3\u30e5\u30fc\u3084\u30c1\u30fc\u30e0\u958b\u767a\u3067\u306e\u4fe1\u983c\u304c\u9ad8\u307e\u308a\u3001\u30a8\u30f3\u30b8\u30cb\u30a2\u3068\u3057\u3066\u4e00\u6bb5\u4e0a\u306e\u30b9\u30c6\u30fc\u30b8\u306b\u9032\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<\/div>\n","protected":false},"featured_media":1622,"template":"","_links":{"self":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route\/1621"}],"collection":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route"}],"about":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/types\/route"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media\/1622"}],"wp:attachment":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media?parent=1621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}