Hi,
I am stuck with a problem in Hibernate.I want to query a composite key (OrderID) of Order_details class whose getters and setters are in OrderCompo class.
My select query is like this :
Code:
OrdrSumList=session.createQuery("select OrderID,(sum(item_value*item_uprice)) FROM Order_details group by OrderID").list();
I am getting the error:
Code:
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode +-[IDENT] IdentNode: 'OrderID'
Also i have to display the OrderID and the sum total in a jsp page using struts.I am not able to display two values in corresponding header in jsp page using iterator.
Can anybody help me to solve this issue.Please please please...
My code snippets are here:
Order_details.java
Code:
@Entity
public class Order_details implements Serializable
{
[b]private OrderCompo ordcmpo;[/b]//Compo class containing composite key
private Order_Header ordr_hdr;
private double item_uprice;
private double order_disc;
private double item_value;
private Item_Master item;
private UOM_Master uom;
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name="OrderID" ,column= @Column(name="OrderID" ,nullable=false)),
@AttributeOverride(name="Ord_line_no" ,column= @Column(name="Ord_line_no",nullable=false)) })
public OrderCompo getOrdcmpo() {
return ordcmpo;
}
public void setOrdcmpo(OrderCompo ordcmpo) {
this.ordcmpo = ordcmpo;
}
OrderCompo.java Compo class containing composite key
Code:
@Embeddable
public class OrderCompo implements Serializable
{
private int OrderID;
private int Ord_line_no;
@Column( nullable = false)
public int getOrderID() {
return OrderID;
}
public void setOrderID(int orderID) {
OrderID = orderID;
}
@Column( nullable = false)
public int getOrd_line_no() {
return Ord_line_no;
}
public void setOrd_line_no(int ord_line_no) {
Ord_line_no = ord_line_no;
}
jsp pageCode:
<s:div cssClass="rc_trdtttl" style="width:100px;">Order ID</s:div>
<s:div cssClass="rc_trdtttl" style="width:100px;">Total Amount</s:div>
<s:iterator value="orderList">
<s:div cssClass="rc_trdt" style="width:100px;"><s:property value="" /></s:div>
<s:div cssClass="rc_trdt" style="width:100px;"><s:property value="" /></s:div>
</s:iterator>
Please consider my request :( .Looking forward for your response...
Thanks in advance.......