-->
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: HQL question
PostPosted: Thu Jan 22, 2004 4:31 pm 
Newbie

Joined: Fri Dec 05, 2003 11:07 am
Posts: 14
Hi,

I'm trying to figure out how to do the HQL for select distinct.

I have an object called BOL that maps to table called Mbol

table structure
=================
rowid
BOLNum
OrderNum
SKU
ShipQuantity

Object
===========================
public class BOL {
private long rowID;
private String bolNumber;
private String orderNum;
private String sku;
private int shipQuan;

public String getOrderNum() {
return orderNum;
}

public int getShipQuan() {
return shipQuan;
}

public String getSku() {
return sku;
}

public void setOrderNum(String string) {
orderNum = string;
}

public void setShipQuan(int i) {
shipQuan = i;
}

public void setSku(String string) {
sku = string;
}

public String getBolNumber() {
return bolNumber;
}

public void setBolNumber(String string) {
bolNumber = string;
}

public long getRowID() {
return rowID;
}

public void setRowID(long i) {
rowID = i;
}

}
===========================================

I want to do a query

select distinct OrderNum from mbol where BOLNum = "XXXX"

Is there a way this can be done in HQL ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 5:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Of course:

Code:
select distinct b.orderNum from BOL b where b.bolNum = xxx


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.