-1

我得到了java.lang.IllegalArgumentException类似于下面给出的链接。为了解决它,我尝试将字段类型从整数更改为长。但我仍然得到:

Caused by: java.lang.IllegalArgumentException: Parameter value [5] was not matching type [com.buddhiedge.server.entity.StudyplanCategory]

StudyplanCategory 是实体类。

该问题类似于以下链接中的问题。 Hibernate - 参数值 [2011] 与类型 [java.lang.Integer] 不匹配。怎么解决? 我的实体类是:

@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;

    }
4

1 回答 1

0

看来您是5作为参数传递给查询的。如果要传递 ID 而不是实体,请将查询更改为:

WHERE s.parentCategory.id=:parentCategoryId
于 2012-04-28T09:49:49.323 回答