Example:
public enum ShapeType {
CIRCLE, SQUARE, RECTANGLE TRIANGLE
}
public ShapeEnity {
@Enumerated(EnumType.STRING)
private ShapeType shapeType;
.......
}
public ShapeDTO {
private String shapeType;
....
}
public ShapeFinder {
public ShapeDTO find() {
QShape shape = QShape.shape;
return createQuery()
.from(shape)
.list(Projections.fields(ShapeDTO.class,
shape.shapeType.stringValue
))
}
}
As in the example above, I would like to get string value of enum ShapeType in DTO object. How should this conversion look like? I tried as in the example above and looks good, but when I use shapeType.stringValue() and then Hibernate create query with call function to_char(Oracle) or str (Sybase), as in example:
SELECT TO_CHAR(ShapeType) From Shape;
Why? How to fix it?