{"id":106,"date":"2019-12-06T14:01:19","date_gmt":"2019-12-06T05:01:19","guid":{"rendered":"http:\/\/kpc2019.satoshis.jp\/?p=106"},"modified":"2019-12-06T16:11:52","modified_gmt":"2019-12-06T07:11:52","slug":"%e6%9c%ac%e6%a3%9a%e3%82%a2%e3%83%97%e3%83%aa%e3%81%ab%e6%9c%ac%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/kpc2019.satoshis.jp\/?p=106","title":{"rendered":"\u672c\u68da\u30a2\u30d7\u30ea\u306b\u672c\u3092\u8ffd\u52a0\u3059\u308b"},"content":{"rendered":"<p><strong>HSQLDB\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u3092\u4f7f\u7528\u3059\u308b<\/strong><br \/>\n\u914d\u5e03\u30d5\u30a9\u30eb\u30c0\u304b\u3089hsqldb\u30d5\u30a9\u30eb\u30c0\u3092\u500b\u3005\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3002<br \/>\nhsqldb.bat \u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u304c\u8d77\u52d5\u3059\u308b\u3002<\/p>\n<p>application.properties \u30d5\u30a1\u30a4\u30eb\u306e\u4fee\u6b63<\/p>\n<pre class=\"brush: plain; highlight: [1,5,6]; title: ; notranslate\" title=\"\">\r\nspring.datasource.url=jdbc:hsqldb:hsql:\/\/localhost\/bookshelf\r\nspring.datasource.username=SA\r\nspring.datasource.password=\r\nspring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver\r\nspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect\r\nspring.jpa.hibernate.ddl-auto=update\r\n<\/pre>\n<p><strong>\u672c\u68da\u30a2\u30d7\u30ea\u306b\u672c\u3092\u8ffd\u52a0\u3059\u308b<\/strong><br \/>\n\u672c\u68da\u3068\u540c\u69d8\u306b\u8ffd\u52a0\u3057\u3066\u3044\u3051\u3070\u3088\u3044\u3002<\/p>\n<p>\u672c\u68da\u306e\u6642\u306f<br \/>\nModel: Bookshelf<br \/>\nController: BookshelfController<br \/>\nView: bookshelf.html<\/p>\n<p>\u672c\u3082\u672c\u68da\u3068\u540c\u69d8\u306b\u3001<br \/>\nModel: Book<br \/>\nController: BookController<br \/>\nView: book.html<\/p>\n<p>\u307e\u305a\u306f Book.java \u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.or.jeed;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.Id;\r\nimport javax.validation.constraints.NotEmpty;\r\nimport javax.validation.constraints.NotNull;\r\n\r\n@Entity\r\npublic class Book {\r\n\t@Id\r\n\t@GeneratedValue\r\n\t@Column\r\n\t@NotNull\r\n\tprivate long id;\r\n\r\n\t@Column\r\n\t@NotEmpty\r\n\tprivate String title;\r\n\r\n\t@Column\r\n\t@NotEmpty\r\n\tprivate String author;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getTitle() {\r\n\t\treturn title;\r\n\t}\r\n\r\n\tpublic void setTitle(String title) {\r\n\t\tthis.title = title;\r\n\t}\r\n\r\n\tpublic String getAuthor() {\r\n\t\treturn author;\r\n\t}\r\n\r\n\tpublic void setAuthor(String author) {\r\n\t\tthis.author = author;\r\n\t}\r\n}\r\n\r\n\r\n\u6b21\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3002\r\n\r\nBookController.java\r\n&#x5B;java]\r\npackage jp.or.jeed;\r\n\r\nimport java.util.List;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.ModelAttribute;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\n@Controller\r\npublic class BookController {\r\n\r\n\t@Autowired\r\n\tprivate BookRepository repository;\r\n\r\n\t@RequestMapping(value = &quot;\/book&quot;, method = RequestMethod.GET)\r\n\tpublic ModelAndView list(ModelAndView mav) {\r\n\t\tmav.setViewName(&quot;book&quot;);\r\n\t\tmav.addObject(&quot;book&quot;, new Book());\r\n\t\tList&lt;Book&gt; list = repository.findAll();\r\n\t\tmav.addObject(&quot;list&quot;, list);\r\n\t\treturn mav;\r\n\t}\r\n\r\n\t@RequestMapping(value = &quot;\/book&quot;, method = RequestMethod.POST)\r\n\tpublic ModelAndView post(ModelAndView mav,\r\n\t\t\t@ModelAttribute(&quot;book&quot;) Book book) {\r\n\t\trepository.saveAndFlush(book);\r\n\t\treturn new ModelAndView(&quot;redirect:\/book&quot;);\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>\u30d3\u30e5\u30fc\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u306a\u308bHTML\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\nbook.html<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u672c\u30ea\u30b9\u30c8&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u672c\u30ea\u30b9\u30c8&lt;\/h1&gt;\r\n&lt;p&gt;\u672c\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3057\u307e\u3059\u3002&lt;\/p&gt;\r\n\r\n\r\n&lt;form action=&quot;\/book&quot; method=&quot;post&quot; th:object=&quot;${book}&quot;&gt;\r\n  \u30bf\u30a4\u30c8\u30eb: &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot; \/&gt;&lt;br \/&gt;\r\n  \u8457\u8005: &lt;input type=&quot;text&quot; name=&quot;author&quot; th:value=&quot;*{author}&quot; \/&gt;&lt;br \/&gt;\r\n  &lt;input type=&quot;submit&quot; value=&quot;\u672c\u3092\u4f5c\u6210&quot; \/&gt;\r\n&lt;\/form&gt;\r\n\r\n&lt;hr \/&gt;\r\n&lt;table&gt;\r\n  &lt;tr&gt;\r\n    &lt;th&gt;ID&lt;\/th&gt;&lt;th&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/th&gt;&lt;th&gt;\u8457\u8005&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr th:each=&quot;b : ${list}&quot;&gt;\r\n    &lt;td th:text=&quot;${b.id}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${b.title}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${b.author}&quot;&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u623b\u308b&lt;\/a&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u306e\u3084\u308a\u3068\u308a\u3092\u884c\u3046\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<p>BookRepository.java<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.or.jeed;\r\n\r\nimport org.springframework.data.jpa.repository.JpaRepository;\r\n\r\npublic interface BookRepository extends JpaRepository&lt;Book, Long&gt; {\r\n\r\n}\r\n<\/pre>\n<p><strong>\u672c\u3092\u672c\u68da\u306b\u683c\u7d0d\u3059\u308b\uff08\u95a2\u9023\u4ed8\u3051\u308b\uff09<\/strong><\/p>\n<p>\u672c\u306b\u5bfe\u3057\u3066\u306f1\u500b\u306e\u672c\u68da\u304c\u95a2\u9023\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; highlight: [27,28,54,55,56,57,58,59,60]; title: ; notranslate\" title=\"\">\r\npackage jp.or.jeed;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.ManyToOne;\r\nimport javax.validation.constraints.NotEmpty;\r\nimport javax.validation.constraints.NotNull;\r\n\r\n@Entity\r\npublic class Book {\r\n\t@Id\r\n\t@GeneratedValue\r\n\t@Column\r\n\t@NotNull\r\n\tprivate long id;\r\n\r\n\t@Column\r\n\t@NotEmpty\r\n\tprivate String title;\r\n\r\n\t@Column\r\n\t@NotEmpty\r\n\tprivate String author;\r\n\r\n\t@ManyToOne\r\n\tprivate Bookshelf bookshelf;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getTitle() {\r\n\t\treturn title;\r\n\t}\r\n\r\n\tpublic void setTitle(String title) {\r\n\t\tthis.title = title;\r\n\t}\r\n\r\n\tpublic String getAuthor() {\r\n\t\treturn author;\r\n\t}\r\n\r\n\tpublic void setAuthor(String author) {\r\n\t\tthis.author = author;\r\n\t}\r\n\r\n\tpublic Bookshelf getBookshelf() {\r\n\t\treturn bookshelf;\r\n\t}\r\n\r\n\tpublic void setBookshelf(Bookshelf bookshelf) {\r\n\t\tthis.bookshelf = bookshelf;\r\n\t}\r\n}\r\n<\/pre>\n<p>Bookshelf \u304b\u3089 Book \u3078\u306e\u95a2\u9023\u4ed8\u3051\u3082\u884c\u3046\u3002<\/p>\n<pre class=\"brush: java; highlight: [25,26,44,45,46,47,48,49,50]; title: ; notranslate\" title=\"\">\r\npackage jp.or.jeed;\r\n\r\nimport java.util.List;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.OneToMany;\r\nimport javax.validation.constraints.NotEmpty;\r\nimport javax.validation.constraints.NotNull;\r\n\r\n@Entity\r\npublic class Bookshelf {\r\n\t@Id\r\n\t@GeneratedValue\r\n\t@Column\r\n\t@NotNull\r\n\tprivate long id;\r\n\r\n\t@Column\r\n\t@NotEmpty\r\n\tprivate String name;\r\n\r\n\t@OneToMany\r\n\tprivate List&lt;Book&gt; books;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tpublic List&lt;Book&gt; getBooks() {\r\n\t\treturn books;\r\n\t}\r\n\r\n\tpublic void setBooks(List&lt;Book&gt; books) {\r\n\t\tthis.books = books;\r\n\t}\r\n}\r\n<\/pre>\n<p>\u672c\u306e\u30ea\u30b9\u30c8\u306b\u3001\u672c\u68da\u306e\u540d\u524d\u3082\u8868\u793a\u3059\u308b\u3002<\/p>\n<p>book.html<\/p>\n<pre class=\"brush: xml; highlight: [23,29,30]; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u672c\u30ea\u30b9\u30c8&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u672c\u30ea\u30b9\u30c8&lt;\/h1&gt;\r\n&lt;p&gt;\u672c\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3057\u307e\u3059\u3002&lt;\/p&gt;\r\n\r\n\r\n&lt;form action=&quot;\/book&quot; method=&quot;post&quot; th:object=&quot;${book}&quot;&gt;\r\n  \u30bf\u30a4\u30c8\u30eb: &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot; \/&gt;&lt;br \/&gt;\r\n  \u8457\u8005: &lt;input type=&quot;text&quot; name=&quot;author&quot; th:value=&quot;*{author}&quot; \/&gt;&lt;br \/&gt;\r\n  \u672c\u68da: &lt;input type=&quot;text&quot; name=&quot;bookshelf&quot; th:value=&quot;*{bookshelf}&quot;\/&gt;&lt;br \/&gt;\r\n  &lt;input type=&quot;submit&quot; value=&quot;\u672c\u3092\u4f5c\u6210&quot; \/&gt;\r\n&lt;\/form&gt;\r\n\r\n&lt;hr \/&gt;\r\n&lt;table&gt;\r\n  &lt;tr&gt;\r\n    &lt;th&gt;ID&lt;\/th&gt;&lt;th&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/th&gt;&lt;th&gt;\u8457\u8005&lt;\/th&gt;&lt;th&gt;\u672c\u68da&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr th:each=&quot;b : ${list}&quot;&gt;\r\n    &lt;td th:text=&quot;${b.id}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${b.title}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${b.author}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:if=&quot;${b.bookshelf != null}&quot; th:text=&quot;${b.bookshelf.name}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:if=&quot;${b.bookshelf == null}&quot; th:text=&quot;\u672c\u68da\u306b\u5165\u3063\u3066\u307e\u305b\u3093&quot;&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u623b\u308b&lt;\/a&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u672c\u3092\u683c\u7d0d\u3059\u308b\u672c\u68da\u3092\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<p>\u307e\u305a\u306f\u5909\u66f4\u3059\u308b\u305f\u3081\u306e\u753b\u9762\u306b\u98db\u3070\u305b\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<pre class=\"brush: xml; highlight: [23,32]; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u672c\u30ea\u30b9\u30c8&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u672c\u30ea\u30b9\u30c8&lt;\/h1&gt;\r\n&lt;p&gt;\u672c\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3057\u307e\u3059\u3002&lt;\/p&gt;\r\n\r\n\r\n&lt;form action=&quot;\/book&quot; method=&quot;post&quot; th:object=&quot;${book}&quot;&gt;\r\n  \u30bf\u30a4\u30c8\u30eb: &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot; \/&gt;&lt;br \/&gt;\r\n  \u8457\u8005: &lt;input type=&quot;text&quot; name=&quot;author&quot; th:value=&quot;*{author}&quot; \/&gt;&lt;br \/&gt;\r\n  \u672c\u68da: &lt;input type=&quot;text&quot; name=&quot;bookshelf&quot; th:value=&quot;*{bookshelf}&quot;\/&gt;&lt;br \/&gt;\r\n  &lt;input type=&quot;submit&quot; value=&quot;\u672c\u3092\u4f5c\u6210&quot; \/&gt;\r\n&lt;\/form&gt;\r\n\r\n&lt;hr \/&gt;\r\n&lt;table&gt;\r\n  &lt;tr&gt;\r\n    &lt;th&gt;ID&lt;\/th&gt;&lt;th&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/th&gt;&lt;th&gt;\u8457\u8005&lt;\/th&gt;&lt;th&gt;\u672c\u68da&lt;\/th&gt;&lt;th&gt;\u4fee\u6b63&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr th:each=&quot;b : ${list}&quot;&gt;\r\n    &lt;td th:text=&quot;${b.id}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${b.title}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${b.author}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:if=&quot;${b.bookshelf != null}&quot; th:text=&quot;${b.bookshelf.name}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:if=&quot;${b.bookshelf == null}&quot; th:text=&quot;\u672c\u68da\u306b\u5165\u3063\u3066\u307e\u305b\u3093&quot;&gt;&lt;\/td&gt;\r\n    &lt;td&gt;&lt;a th:href=&quot;@{'\/edit\/' + ${b.id}}&quot;&gt;\u7de8\u96c6&lt;\/a&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u623b\u308b&lt;\/a&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>BookController \u306b\u3001\u7de8\u96c6\u3059\u308b\u305f\u3081\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; first-line: 36; title: ; notranslate\" title=\"\">\r\n\t@RequestMapping(value = &quot;\/edit\/{id}&quot;, method = RequestMethod.GET)\r\n\tpublic ModelAndView edit(ModelAndView mav, @PathVariable long id) {\r\n\t\tmav.setViewName(&quot;edit&quot;);\r\n\t\tOptional&lt;Book&gt; data = repository.findById(id);\r\n\t\tmav.addObject(&quot;book&quot;, data.get());\r\n\t\treturn mav;\r\n\t}\r\n<\/pre>\n<p>\u672c\u306e\u7de8\u96c6\u3092\u3059\u308b\u305f\u3081\u306eHTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/p>\n<p>edit.html<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u672c\u306e\u7de8\u96c6&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u672c\u306e\u7de8\u96c6&lt;\/h1&gt;\r\n&lt;p&gt;\u672c\u306e\u30bf\u30a4\u30c8\u30eb\u306a\u3069\u3092\u5909\u66f4\u3057\u307e\u3059\u3002&lt;\/p&gt;\r\n\r\n\r\n&lt;form action=&quot;\/edit&quot; method=&quot;post&quot; th:object=&quot;${book}&quot;&gt;\r\n  \u30bf\u30a4\u30c8\u30eb: &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot; \/&gt;&lt;br \/&gt;\r\n  \u8457\u8005: &lt;input type=&quot;text&quot; name=&quot;author&quot; th:value=&quot;*{author}&quot; \/&gt;&lt;br \/&gt;\r\n  \u672c\u68da: &lt;input type=&quot;text&quot; name=&quot;bookshelf&quot; th:value=&quot;*{bookshelf}&quot;\/&gt;&lt;br \/&gt;\r\n  &lt;input type=&quot;submit&quot; value=&quot;\u672c\u3092\u7de8\u96c6&quot; \/&gt;\r\n&lt;\/form&gt;\r\n\r\n\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u623b\u308b&lt;\/a&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u672c\u68da\u306e\u3068\u3053\u308d\u306b\u304d\u3061\u3093\u3068\u5024\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u3001HTML\u3092\u5909\u66f4\u3059\u308b\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u672c\u306e\u7de8\u96c6&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u672c\u306e\u7de8\u96c6&lt;\/h1&gt;\r\n&lt;p&gt;\u672c\u306e\u30bf\u30a4\u30c8\u30eb\u306a\u3069\u3092\u5909\u66f4\u3057\u307e\u3059\u3002&lt;\/p&gt;\r\n\r\n\r\n&lt;form action=&quot;\/edit&quot; method=&quot;post&quot; th:object=&quot;${book}&quot;&gt;\r\n  &lt;input type=&quot;hidden&quot; name=&quot;id&quot; th:value=&quot;*{id}&quot; \/&gt;\r\n  &lt;table&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot; \/&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;\u8457\u8005&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;author&quot; th:value=&quot;*{author}&quot; \/&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;\u672c\u68da\u306eID&lt;\/td&gt;\r\n      &lt;td th:if=&quot;*{bookshelf != null}&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;bookshelf&quot; th:value=&quot;*{bookshelf.id}&quot;\/&gt;&lt;\/td&gt;\r\n      &lt;td th:if=&quot;*{bookshelf == null}&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;bookshelf&quot; value=&quot;&quot;\/&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n  &lt;\/table&gt;\r\n  &lt;input type=&quot;submit&quot; value=&quot;\u672c\u3092\u7de8\u96c6&quot; \/&gt;\r\n&lt;\/form&gt;\r\n\r\n\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u623b\u308b&lt;\/a&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u7de8\u96c6\u3057\u305f\u672c\u306e\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u3063\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u66f4\u65b0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; first-line: 44; title: ; notranslate\" title=\"\">\r\n\t@RequestMapping(value = &quot;\/edit&quot;, method = RequestMethod.POST)\r\n\tpublic ModelAndView update(ModelAndView mav,\r\n\t\t\t@ModelAttribute(&quot;book&quot;) Book book) {\r\n\t\trepository.saveAndFlush(book);\r\n\t\treturn new ModelAndView(&quot;redirect:\/book&quot;);\r\n\t}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>HSQLDB\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u3092\u4f7f\u7528\u3059\u308b \u914d\u5e03\u30d5\u30a9\u30eb\u30c0\u304b\u3089hsqldb\u30d5\u30a9\u30eb\u30c0\u3092\u500b\u3005\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3002 hsqldb.bat \u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u304c\u8d77\u52d5\u3059\u308b\u3002 application.pr &hellip; <a href=\"https:\/\/kpc2019.satoshis.jp\/?p=106\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u672c\u68da\u30a2\u30d7\u30ea\u306b\u672c\u3092\u8ffd\u52a0\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-git","category-spring-boot"],"views":3212,"_links":{"self":[{"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=106"}],"version-history":[{"count":17,"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":123,"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/106\/revisions\/123"}],"wp:attachment":[{"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kpc2019.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}