class ReservationStatusConverter implements AttributeConverter<ReservationStatus, String> {

    @Override
    public ReservationStatus convertToEntityAttribute(String y) {
        if (null == y) {
            return null;
        }

        for (ReservationStatus elem : ReservationStatus.values()) {
            if (elem.name().equalsIgnoreCase(y)) {
                return elem;
            }
        }
        
        throw new IllegalArgumentException("Cannot map " + y);
    }

}