These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: one Update fails in a loop and the rest gets completed
PostPosted: Mon Apr 11, 2005 7:24 am 
Newbie

Joined: Mon Apr 11, 2005 2:28 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.