Hi
I am a newbie in Hibernate but have to work on an Project which uses Hibernate.
The project is using Hibernate 2.1, Struts, a proprietory layer which interacts with Hibernate and Oracle 9i and Tomcat 4.1
I have an method (A) which calls certain other classes of the proprietory framework layer and passes on the required information to Hibernate class.
The calling done in the start method (A) is being called in a Transaction meaning after new Transaction and transaction.begin()
The code below is being called from the proprietory framework classes which receives the necessary inputs from method A
strQry = "from <className>master in class " + <className>DAO.class + " where <className>master.<field> = ?"+ and <className>master.<field> = ?";
session.find(strQry, new Object[] {pstr1, pstr2}, new Type[] {Hibernate.STRING, Hibernate.DATE});
The problem I face is really strange as the above code is being executed in a loop in method A - say the loop is for 0 to 4, The above code works fine for all the elements of the loop except one (which is as similar as other data) and fails to update the required table which is otherwise updated for the rest of the elements.
Also when I check the output on the console (as ShowSQL is set to true)
it shows me two statements which signify that
an UPDATE and a SELECT is being fired from somewhere, I do not know when this gets fired from where and how but it is I guess on calling the session.find method.
Hibernate: update <tablename> set <fieldname>=?, <fieldname>=?, <fieldname>=?, <fieldname>=?, <fieldname>=?, <fieldname>=?, <fieldname>=? where <fieldname>=? and <fieldname>=? and <fieldname>=? and <fieldname>=?
and
Hibernate: select <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <lablename>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname>, <tablename>.<fieldname> as <labelname> from <tablename> <tablename> where (<tablename>.<fieldname>=? )and(<tablename>.<fieldname>=? )
The above two queries get fired successfully for all the elements except one and the strange thing is that the 2nd element in the loop fails where in the Update query is not displayed on the console for this element but the select query gets fired as usual.
When checked all the parameter info and other details are having no issues as they are the same as when passed to this method.
Also one more major issue is that when executing my application on Tomcat I have to restart it n number of times as it goes down and throws OutOfMemoryError when executing certain Hibernate: Select statement which if fired on Toad gets the result in some milliseconds.
Because of this If I turn on the DEBUG Mode for Hibernate in Log4j.properties file, it goes on processing for ever (displaying a page) and later throws OutOfMemoryError at times or SQLException - Size Data Unit (SDU) mismatch error or Bad Data Type error.
Any help in this regard will be of great help and will be highly appreciated.
Thanks
Dorman
|