我正在使用 spring data jpa(MYSQL) 开发一个 Spring boot 项目,当我达到这个终点时,http://localhost:8080/admin/interviews/101 我收到此错误
{
"timestamp": "2019-10-11T13:45:37.111+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Parameter value [101] did not match expected type [com.yash.arci.model.Interviews (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [101] did not match expected type [com.yash.arci.model.Interviews (n/a)]",
"trace": "org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [101] did not match expected type [com.yash.arci.model.Interviews (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [101] did not match expected type [com.yash.arci.model.Interviews (n/a)]\r\n\tat org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible
这是 InterviewStatus 课程
@Entity
@Table(name ="interview_status" )
public class InterviewStatus implements Serializable {
private static final long serialVersionUID = -6353284727527331855L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name ="interviewId",insertable = false, updatable = false)
private Interviews interviewId;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name ="statusId",insertable = false, updatable = false)
private Status statusId;
..........
}
@Repository
public interface InterviewStatusRepository extends
JpaRepository<InterviewStatus, Integer> {
InterviewStatus findByInterviewId(Integer interviewId);
}
我想要根据 InterviewId 进行记录。我已经可以根据主键获得,但我希望根据 Interview Id 获得它,我在 InterviewStatus 表中有 InterviewId 列。
慕姐8265434
相关分类