posted 14 years ago
I want you to look to this simple insert mechanism using sql-insert and stored procedure.
I am using Hibernate 3 and MySql 5.5.8.
I have the following table HourOfTheDayDaily in my database webalizer
This table is related to the object com.financial.webalizer.core.context.HourOfTheDay in the hibernate config file as given below.
The following code will insert the object to the database
Now please read what I want to do. There can be more than one commit with the same primary key (Please note that my primary key is a composite key).
I want to do an insert on the first attempt that means if a record with the give primary key is not present yet in the table .
If there is a record present in the table I want update the table colums PAGES,HITS and VOLUME by adding the new values to the values in the table.
I tried INSERT ...ON DUPLICATE UPDATE but it will not work on records with composite primary key.
Next option was to use a stored procedure . So I prepared a stored procedure insertHourOfTheDay as given below.
My problem is Nothing happens when I run my code no data is inserted or updated and i get the following exceptions.
and
I am debugging this simple code for last three days and could not figure out any thing . Can any body help me.
I just want to know is there any body call my bean's Getter and Setter methods with "Please" in front - My favorite quip from Bugzilla