自定义查询方法的JPA资源库抛出错误:
org.h2.jdbc.JdbcSQLException: Table "NBMRBANKDTLSENTITY" not found; SQL statement:
select NBMRBankDtlsEntity from NBMRBankDtlsEntity where NBMRBankDtlsEntity.ipphId = ? [42102-191]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
类:
@Repository
public interface NBMRBankDtlsRepository extends JpaRepository<NBMRBankDtlsEntity, Long> {
@Query(value ="select n from NBMRBankDtlsEntity n where n.ipphId = :ipphId",nativeQuery = true)
Optional<NBMRBankDtlsEntity> findByIPPHId(@Param("ipphId") Long ipphId);
}
最佳答案
错误消息告诉您:Table "NBMRBANKDTLSENTITY" not found
。因此,它可能不存在。要解决此问题,您必须通过脚本或hibernates schema creation功能手动创建表。