Hello,
I need to evaluate a field ("identifier") which is situated in a collection, within an entity. As stated in the documentation it is not possible to navigate there with the dot operator since its a collection. Is it there a way to evaluate this field? Here is the query, the entity and the related embeddable class.
Thanks
public synchronized List<ProductData> getList(String key){
TypedQuery<ProductData> myquery = em.createQuery(
"SELECT item FROM ProductData item "+
"WHERE item.sku =: key "+
"OR id MEMBER OF :item.apiId.identifier "+
"ORDER BY item.sku DESC"
,ProductData.class)
.setParameter("key", key)
.setParameter("id", key)
;
List<ProductData> lists = myquery.getResultList();
return lists;
}
@Entity
public class ProductData implements Serializable {
@Id @GeneratedValue
private long id;
@ElementCollection(fetch = FetchType.EAGER)
private List<ApiIdData_> apiId;
}
@Embeddable
public class ApiIdData_ implements Serializable {
private String apiName;
private String identifier;
}