I have two relations
public class ObjectiveRelation extends BaseEntity implements Cloneable {
@Column
private String orgId;
@ManyToOne
@JoinColumn(name = "descendant_id", columnDefinition = "BIGINT DEFAULT NULL")
private Objective descendantObjective;
}
public class Objective extends BaseEntity implements Cloneable {
@Column
@Enumerated(EnumType.STRING)
private PrivacyType privacyType;
@ElementCollection
@CollectionTable
@Column(name = "user_id")
private Set<String> viewPermittedUsers;
Now I'm trying to create a derived column (with values either 1 or 0) with this query. I'm checking if view_permitted_users is having that particular user or not.
Join<Object, Object> descendantObjectiveJoin = (Join<Object, Object>) objectiveRelationRoot
.fetch(DESCENDANT_OBJECTIVE);
query.multiselect(objectiveRelationRoot,
builder.selectCase().when(builder.and(builder.equal(descendantObjectiveJoin.get(PRIVACY_TYPE), CUSTOM),
descendantObjectiveJoin.get(VIEW_PERMITTED_USERS).in(Arrays.asList(userId))
), builder.literal(1))
But it is throwing error. Caused by: java.sql.SQLException: No value specified for parameter 63. I checked userId is not null while passing. Any other way I can do this?