Trying to use specification for filter data at database level. I have an entity with another entity as an instance wherein the instance variable class contains an Emun field. This defaults to a string in the database for the enum field.
@Entity
public class Outer{
@OneToOne(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
@JoinColumn(name = "current_status")
private Status current;
@OneToOne(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
@JoinColumn(name = "past_status")
private Status past;
...
...
@Entity
public class Status{
@Enumerated(EnumType.STRING)
@Column(name = "state")
private State state;
@Id
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid",strategy = "uuid2")
@Column(name = "id")
private String id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "outer_id")
private Outer outer;
I have created static meta models for both the classes.
How do I create a Predicate to match State using a where in clause with the enum values supplied as Strings(not instances of enums) ?