我有以下查询
@Query("select event from Event event where severity>0)
public List<Event> getEvents();
其中&#34;严重性&#34;财产是一个枚举。 枚举类位于
之下package com.some.company.enums;
public enum EventSeverity {
UNKNOWN(0),
VALUE_1(1),
VALUE_2(2),
...
private final int severity;
private EventSeverity(int severity) {
this.severity = severity;
}
}
我正在尝试将严重性大于0的事件(意味着不 UNKNOWN ) 但由于某种原因,查询还返回 UNKNOWN 值
的结果这是在事件类
中注释属性的方式@Enumerated(EnumType.ORDINAL)
@Column(name = "SEVERITY", nullable = false)
public EventSeverity getSeverity() {
return this.severity;
}