NI-Lab.

nilog:

← 前の日 2022-04-20 次の日 →
← 一年前 一年後 →
Twitter (2022-04-20)
spring.sql.init.schema-locations: classpath:develop-resources/schema.sql
spring.sql.init.data-locations: classpath:develop-resources/data.sql

「今までspring.datasourceにまとめて定義していたものを、分割」

SpringBoot 2.5からschema/dataの指定方法が変わった https://qiita.com/You_name_is_YU/items/06c6103f53406436fea4
[t] 2022-04-20 09:37:18
関連するかも情報
データが入らないなぁと思ったらこれか・・・

「application.ymlのspring.datasource.schemaやspring.datasource. data、spring.datasource.initialization-modeに該当する設定部分に警告」

SpringBoot 2.5からschema/dataの指定方法が変わった - Qiita https://qiita.com/You_name_is_YU/items/06c6103f53406436fea4
[t] 2022-04-20 09:35:43
spring.sql.init.schema-locations: classpath:develop-resources/schema.sql
spring.sql.init.data-locations: classpath:develop-resources/data.sql

「今までspring.datasourceにまとめて定義していたものを、分割」

SpringBoot 2.5からschema/dataの指定方法が変わった https://qiita.com/You_name_is_YU/items/06c6103f53406436fea4
[t] 2022-04-20 09:37:18
Spring Boot 3 (M2) の application properties 設定項目リファレンス。

Common Application Properties https://docs.spring.io/spring-boot/docs/3.0.0-M2/reference/html/application-properties.html
[t] 2022-04-20 09:58:02
spring.jpa.hibernate.ddl-auto=none を指定して Entity クラスの情報から自動的にテーブルが作成されるのを防ぐ。
[t] 2022-04-20 10:03:19
Spring Boot 3 のための Spring Data JPA のドキュメント。Spring Boot 3 のためにドキュメントが修正されているかどうかは知らないけど・・・

"Spring Boot integrates with a number of data technologies, both SQL and NoSQL."

Data https://docs.spring.io/spring-boot/docs/3.0.0-M2/reference/html/data.html
[t] 2022-04-20 10:06:35
Spring Boot 起動してもテーブルが作成されないからファイル名が悪いのかなと思って変更してみたけど、変更前はちゃんと読めてたっぽいな。

Caused by: java.lang.IllegalStateException: No schema scripts found at location 'classpath:dev-schema.sql'
[t] 2022-04-20 10:10:46
Initialize a Database Using Basic SQL Scripts

"It loads SQL from the standard root classpath locations: schema.sql and data.sql, respectively."

“How-to” Guides https://docs.spring.io/spring-boot/docs/3.0.0-M2/reference/html/howto.html#howto.data-initialization.using-basic-sql-scripts
[t] 2022-04-20 10:12:30
あれ、ちゃんとテーブルが作成されてデータも入るようになったぞ(;´∀`) ファイル名がおかしかったのじゃないと思うけど他にいじっていないはず・・・
[t] 2022-04-20 10:18:10
spring.jpa.show-sql=true だとロギングフレームワークを無視してSQL文を出力するみたいなので logging.level .org.hibernate.SQL=DEBUG のほうがいい気がする。詳細に出力するなら logging.level .org.hibernate.type.descriptor.sql=TRACE かな。
[t] 2022-04-20 10:25:00
「DATETIME 型は、日付と時間の両方の部分を含む値に使用されます。 MySQL は、DATETIME 値を'YYYY-MM-DD hh:mm:ss'形式で取得して表示します。 サポートしている範囲は '1000-01-01 00:00:00' から '9999-12-31 23:59:59' です」

MySQL :: MySQL 8.0 リファレンスマニュアル https://dev.mysql.com/doc/refman/8.0/ja/datetime.html
[t] 2022-04-20 10:30:32
「TIMESTAMP データ型は、日付と時間の両方の部分を含む値に使用されます。 TIMESTAMP には、'1970-01-01 00:00:01' UTC から '2038-01-19 03:14:07' UTC の範囲があります」

MySQL :: MySQL 8.0 リファレンスマニュアル :: 11.2.2 DATE、DATETIME、および TIMESTAMP 型 https://dev.mysql.com/doc/refman/8.0/ja/datetime.html
[t] 2022-04-20 10:30:39
【話題のキーワード】
1. 梅雨入り
2. 129円
3. 倍速視聴
4. 非課税世帯
5. デジポリス
6. エズラ・ミラー
7. MOTHER3
8. 盛山
9. あいの里
10. 神真都
https://search.yahoo.co.jp/realtime #buzzbot
[t] 2022-04-20 10:30:58
Apache Commons DbUtils のソースコードは git コマンドで手元に持ってくるしかないのかな・・・

DbUtils – Source Code Management https://commons.apache.org/proper/commons-dbutils/source-repository.html
[t] 2022-04-20 10:38:54
さすがにもうメンテされていないのかな。最新バージョンは2017年リリースのもの。

"Release 1.7 – 2017-07-20"

DbUtils – Release Notes https://commons.apache.org/proper/commons-dbutils/changes-report.html
[t] 2022-04-20 10:40:49
"The Apache Commons DbUtils package is a set of Java utility classes for easing JDBC development."

Maven Repository: commons-dbutils » commons-dbutils https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils
[t] 2022-04-20 10:43:01
リポジトリ クエリ キーワード

「Spring Data リポジトリのクエリ導出メカニズムで一般的にサポートされているサブジェクトキーワード」

Spring Data JPA - リファレンスドキュメント https://spring.pleiades.io/spring-data/jpa/docs/current/reference/html/#repository-query-keywords
[t] 2022-04-20 10:51:43
JPA リポジトリのメソッド名に findByHogeContaining みたいに Containing キーワードをつけると like 検索を実現してくれて、メソッドに「%」を渡すとちゃんと「\%」に変換してエスケープしてくれてた。ログには「binding parameter [1] as [VARCHAR] - [%\%%]」と出ている。
[t] 2022-04-20 11:02:40
Containing キーワードで like 検索が可能。

「… where x.firstname like ?1 (% にラップされたパラメーターバインド)」

Spring Data JPA - リファレンスドキュメント https://spring.pleiades.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation
[t] 2022-04-20 11:04:10
2回目以降でエラーになる・・・

org.springframework.dao.InvalidDataAccessApiUsageException

Caused by: java.lang.IllegalArgumentException: Parameter value [\] did not match expected type [java.lang.String (n/a)]
at org.hibernate.query.spi.QueryParameterBindingValidator.validate
[t] 2022-04-20 11:09:15
【天気予報】今日の名古屋の天気

4月20日(水) 晴時々曇
最高気温 24℃[+1]
最低気温 9℃[-1]

降水確率
12-18 10%
18-24 10%

西部(名古屋)の天気 - Yahoo!天気・災害 https://weather.yahoo.co.jp/weather/jp/23/5110.html
#天気bot #bot
[t] 2022-04-20 11:15:04
2022年04年20日のnilogをすべて表示する

- NI-Lab.
- Mastodon (@nilab@mastodon-japan.net)
- Twitter (@nilab)
- Timelog (@nilab)
- はてなブックマーク (id:nilab)

Web Services by Yahoo! JAPAN