お世話になります。
Spring boot起動時に以下のエラーが発生します。
EntityクラスとRepositoryクラスが1つずつの場合は起動できますが
EntityクラスとRepositoryクラスを複数追加すると起動できません。
なぜでしょうか。
どなたかご教授願います。
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-02-17 12:44:55.731 ERROR 8783 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vtnRepository' defined in com.example.demo.repository.VtnRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.Map, at table: asset, for columns: [org.hibernate.mapping.Column(reports)] --省略--
package com.example.demo.entity; import com.example.demo.openadr2.transport.OadrObject; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Data @Table(name = "sample_targetvtn") public class VtnEntity { @Id @Column(name = "vtn_id") private String vtnID; // VTN ID @Column(name = "vtn_name") private String vtnName; // VTN名 --省略-- }
package com.example.demo.entity; import com.enernoc.open.oadr2.model.v20b.OadrTransportType; import com.example.demo.openadr2.transport.OadrObject; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Data @Table(name = "sample_sourceven") public class VenEntity { @Id @Column(name = "ven_id") private String venID; // VEN ID @Column(name = "ven_name") private String venName; // VEN Name --省略-- }
package com.example.demo.repository; import com.example.demo.entity.VtnEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * VTN情報 Repository */ @Repository public interface VtnRepository extends JpaRepository<VtnEntity, String> { }
package com.example.demo.repository; import com.example.demo.entity.VenEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * VEN情報 Repository */ @Repository public interface VenRepository extends JpaRepository<VenEntity, String> { }
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。