Hi !
This is my problem:
I want to use Hibernate Batch insert.
Have 3 tables : 1. Item -- Items 2. Bill_item -- Added items to a bill 3. Bill_info -- Information about the bill (Customer Name, Date, ....... etc.)
"Bill_item" can have many "Items" "Bill_info" can have many "Bill_item"
I have Grid of values. .......................................................................................... Customer Name : XYZ Date : 2/4/2009
item Id name quantity item_price Total 1 A 3 12 36 4 C 5 5 25 . . . . . . . . . . .......................................................etc.
i want to Store above date in two tables First two rows in "Bill_info" table and And Item Details in "Bill_item" table
I can Insert this as a Batch insert but the Problem is How can i Pass these values in my method.
public void addBillItem() { ---------------------------------> How can i pass the values to this method ?
for ( int i=0; i<100000; i++ ) {
Bill_item bi= new Bill_item(.....); session.save(bi); if ( i % 20 == 0 ) { //20, same as the JDBC batch size //flush a batch of inserts and release memory: session.flush(); session.clear(); } }
}
thanks.
|