VSCodeの問題というより、SpringBootプロジェクト作成時に遭遇したエラーというべき内容です。ご了承下さい。
プロジェクト作成
VSCode の Spring Initializr でプロジェクトを作成
Dependencies
- Lombok
- JPA
- PostgreSQL
遭遇したエラー
mvn clean package 実行で2つのエラーが発生。
①entityManagerFactory
コンフィグクラスが必要なの感じのエラー
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed
対処方法
pom.xml の <dependencies> に次を追加。
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
②PgConnection.createClob() メソッドはまだ実装されていません。
見覚えのあるエラーです。
Caused by: java.sql.SQLFeatureNotSupportedException: org.postgresql.jdbc.PgConnection.createClob() メソッドはまだ実装されていません。
対処方法
hibernate.properties に以下の定義を追加。
hibernate.jdbc.lob.non_contextual_creation = true