-->
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.  [ 2 posts ] 
Author Message
 Post subject: distinct in Hibernate ?
PostPosted: Sat Jan 31, 2004 12:37 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 9:54 am
Posts: 25
Hi,

is there a way to use 'distinct' queries ?
At the moment I use it like, but unfortunately this is really hardcoded :( :

Code:
    net.sf.hibernate.sql.QuerySelect qs = new net.sf.hibernate.sql.QuerySelect(new
        net.sf.hibernate.dialect.OracleDialect());
    qs.setDistinct(true);
    qs.addSelectColumn("device.deviceName", "");
    qs.addSelectColumn("device.deviceDesc", "");
    qs.addSelectColumn("user.firstName", "");
    String qu = qs.toQueryString() +
        " Devic as device, User as user where device.deviceName in ('tel', 'mobile')";


    Iterator it = session.iterate(qu);


thanks,
--awt


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 31, 2004 2:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
What are you doing there, this is no public Hibernate API. Why dont you just use the distinct keyword in HQL.


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

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.