Shailender, You wrote your tables have over 10 Million records but the big question is, how many records is your query ACTUALLY RETURNing to you? I ask this because some types of Hibernate Queries iterate through records while other types load all records (that the database returned as you query specified) directly into memory.
Query.list()) loads all returned results into memory. Query.iterate() lets you iterate through records. As a result of this, hibernate flushes memory where it can. So, if you are just peeking at the data and then setting your variable to null (or reassigning it to the next iterated record), hibernate will free memory where it needs to so you shouldn't run out of memory. Query.scroll() returns a ScrollableResults object IF your JDBC driver can implement a scrollable result set. This behaves, memory-wise, like a Query.iterate() but allows you to load groups, i.e. pages, of results for quicker skimming through them. I highly recommend this if you need to analyze thousands of records and cannot use a Criteria or Native SQL query to sort, group, or otherwise reduce the number of rows you need returned. If you ARE loading hundreds of MB of data into memory, assuming you have the physical/swap memory available, you should make sure your JVM isn't the problem. Tomcat, for example, can't hold that much memory unless you tell the JVM to allocate more memory for you at Tomcat's start-up time. The flags are mentioned in many archives posts but I'll post them here for you: (Type java -X in a windows shell and look at setting some of the below options in your environment using JAVA_OPTS) -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size Some relevant Hibernate web pages include A) queries: http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html (especially the tips and tricks section at the bottom) 2) Scrolling and filtering: http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#ma nipulatingdata-scrolling Regards, David -----Original Message----- From: Shailender Jain [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 5:34 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Hibernate Hi, I have just completed my application using Strut. I have gone through some of the e-mails talking about Hibernate. In my further enhancement of my application i want to use some object persistence mechanism to make my application run faster. Has anybody used Struts with Hibernate? Did anyone faced memory problem related to Hibernate. I have got tables which have got more then 10 million records. Regards, Shailender Jain --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]