Hello, is there possibility to rewrite a query with hibernate Criteria or hql without sql usage:
Code:
select a.value from (select entity_id, min(value) value
from entity_contact where entity_id in (:entityIds)
and contacttype_id =2 group by entity_id) a
group by a.value
Here is a mapping class:
Code:
@javax.persistence.Entity
@Table(name = "entity_contact")
public class EntityContact {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Integer id;
@ManyToOne (fetch = FetchType.LAZY)
private Entity entity;
@Column (name = "contacttype_id", nullable = false)
private int contactTypeId;
private String value;
private String description;
.............................