Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.1.6
Name and version of the database you are using: SQL Server 2000
Hi all,
I have the following parent-child tables :
Table : Orders
=========
OrderID
---------
1
Table : Items
=========
OrderID ProductID Total
--------- ------------ -----
1 11 1
1 12 1
1 13 1
At runtime I create the following class for table Order:
public class Orders
{
private String orderID;
private int total;
public void setOrderID(String orderID)
{
this.orderID = orderID:
}
public String getOrderID()
{
return this.orderID;
}
public void setTotal(int total)
{
this.total = total;
}
public void getTotal()
{
return this.total;
}
}
When Hibernate queries data from table Order, I need to set the field total with the sum of total in table Items.
Is is possible to achieve that automatically using Hibernate with one-to-many relationship ?
Thanks in advance.
Setya