public enum TransStatus{
NOT_FOUND(12,"RNF"),
CREATED(43,"created");
private Integer statusCode;
private String statusCodeString;
TransStatus(Integer statusCode,String statusCodeString){
this.statusCode = statusCode;
this.statusCodeString = statusCodeString;
}
public Integer getStatusCode() {
return statusCode;
}
public String getStatusCodeString() {
return statusCodeString;
}
}
with Entity class as follows:
@Enumerated(EnumType.STRING)
@Column(name="STATUS")
private TransStatus status;
is there any way that I can map TransStatus column in my entity to the Integer value of enum that is status code, for example, if I have Enum value as NOT_FOUND TransStatus value in entity should be 12,
edit please notice i have two values of enum status code , status code string , what we want is only status code, we have already tried with "Ordinal" it prints the integer value of the enum not the statusCode in my example
答案 0 :(得分:0)