嗨,我收到以下错误提示,试图在我的应用程序中进行一些更改。
您能帮我解决这个问题吗?试图在网上找到相同的东西,但没有任何帮助。

错误堆栈:

org.springframework.dao.InvalidDataAccessApiUsageException: Unknown ordinal value for enum class entity.beschikking.BeschikkingStatus$BeschikkingStatusType: 5; nested exception is java.lang.IllegalArgumentException: Unknown ordinal value for enum class entity.beschikking.BeschikkingStatus$BeschikkingStatusType: 5] with root cause
 java.lang.IllegalArgumentException: Unknown ordinal value for enum class entity.beschikking.BeschikkingStatus$BeschikkingStatusType: 5
at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:112)

类:
 @org.hibernate.annotations.Cache(usage =CacheConcurrencyStrategy.READ_ONLY)
 @Entity
 @Table(name = "beschikking_statussen", schema = "lgr")
 public class BeschikkingStatus implements Serializable {

private static final long serialVersionUID = 1L;
@Id
@Column(unique = true, insertable = false, updatable = false, nullable = false)
@Enumerated(EnumType.STRING)
private BeschikkingStatusType id;

public BeschikkingStatusType getId() {
    return id;
}

public void setId(BeschikkingStatusType id) {
    this.id = id;
}
public enum BeschikkingStatusType {
    ONBEKEND,
    VOORLOPIG,
    DEFINITIEF,
    DEFINITIEF_CORRIGEREN,
    GEARCHIVEERD;
}

}

最佳答案

您正在尝试获取BeschikkingStatusType: 5,但这并不存在,因为枚举只有5个值,并且从0开始计数。

07-24 09:34