我得到的java.lang.IllegalArgumentException
类似于下面给出的链接。要解决它,我尝试将字段类型从Integer更改为Long。但我仍然得到:
Caused by: java.lang.IllegalArgumentException: Parameter value [5] was not matching type [com.buddhiedge.server.entity.StudyplanCategory]
StudyplanCategory是实体类。
问题类似于以下链接中的问题。 Hibernate - Parameter value [2011] was not matching type [java.lang.Integer]. How to solve? 我的实体类是:
@JsonIgnoreProperties({ "studyplanCategoryList", "dropboxzipfile",
"parentCategory", "createdDate", "updatedDate" })
@JsonPropertyOrder({ "id", "name", "status", "sptTutorialsList" })
@Entity
@Table(name = "studyplan_category", catalog = "buddhiedgeserver_db", schema = "", uniqueConstraints = { @UniqueConstraint(columnNames = { "dropboxzipfile" }) })
@NamedQueries({
@NamedQuery(name = "StudyplanCategory.findSubStudyPlanById", query = "SELECT s FROM StudyplanCategory s WHERE s.parentCategory=:parentCategory order by updatedDate DESC")})
public class StudyplanCategory implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@NotNull
@Column(name = "id", nullable = false)
private Long id;
}
答案 0 :(得分:0)
您似乎将5
作为参数传递给查询。如果要传递ID而不是实体,请将查询更改为:
WHERE s.parentCategory.id=:parentCategoryId