-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Please help to rewrite sql query with Criteria or hql
PostPosted: Thu May 27, 2010 11:30 am 
Newbie

Joined: Fri Mar 19, 2010 12:29 pm
Posts: 12
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;
.............................


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.