I have a working query that I need to modify by filtering with a constant enumeration value.
Now it looks like this:
public static final String venueQuery = "select distinct v from package.Venue v " + "<some joins here> " + "WHERE v.venueType = package.enums.VenueType.VOUCHER_PROVIDER ";
Changing data in this way causes
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token
The column definition is as follows:
@Enumerated(EnumType.STRING) @Column(name = "venue_type") private VenueType venueType;
The definition of Enum is as follows:
public enum VenueType { RESTAURANT, BAR, CAFE, FUN_CLUB, VOUCHER_PROVIDER }
I am sure that other parts of the request work fine, because exceptions are not excluded after its removal.
Are there any tricks to set the enum constant value in an HQL query?
java enums hibernate hql
joro
source share