Announcement Announcement Module
Collapse
No announcement yet.
Spring + Hibernate Performance issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + Hibernate Performance issue

    I have hibernate 3.3.1, I have an hql query (quite complex);

    This hql query is resolved in a single (but long) sql query.

    If I run this query from a java application that use plain hibernate it takes about 300 msec.

    If i run the same query from a web application (tomact + Spring + hibernate) it takes about 70 seconds.

    This is my application context

    <bean id="mySessionFactory"
    class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource" ref="myDataSource" />
    <property name="mappingResources">
    <list>
    <value>
    osservatorio/persistance/mapping/Osservatorio.hbm.xml
    </value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>

    <prop key="connection.provider_class">org.hibernate.conn ection.C3P0ConnectionProvider</prop>
    <prop key="hibernate.c3p0.max_size">5</prop>
    <prop key="hibernate.c3p0.max_statements">5</prop>
    <prop key="hibernate.c3p0.min_size">1</prop>
    <prop key="hibernate.c3p0.timeout">100</prop>
    <prop key="hibernate.c3p0.autoCommitOnClose">true</prop>
    <prop key="hibernate.c3p0.acquireRetryDelay">1000</prop>
    <prop key="hibernate.c3p0.acquireRetryAttempts">60</prop>
    <prop key="hibernate.c3p0.breakAfterAcquireFailure">fals e</prop>
    <prop key="hibernate.c3p0.acquire_increment">1</prop>
    <prop key="hibernate.c3p0.idle_test_period">100</prop> <!-- seconds -->
    <prop key="hibernate.c3p0.max_size">100</prop>
    <prop key="hibernate.c3p0.max_statements">0</prop>
    <prop key="hibernate.c3p0.min_size">10</prop>
    <prop key="hibernate.c3p0.timeout">100</prop>

    <prop key="hibernate.hbm2ddl.auto">update</prop>
    <prop key="hibernate.dialect">org.hibernate.dialect.Orac le10gDialect</prop>
    <prop key="hibernate.show_sql">false</prop>

    </props>
    </property>
    </bean>

    <!-- hibernateTemplate -->
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <property name="sessionFactory">
    <ref bean="mySessionFactory" />
    </property>
    </bean>

    <!-- Classi DAO -->
    <bean id="configDao" class="osservatorio.persistance.dao.impl.ConfigDao ">
    <property name="hibernateTemplate">
    <ref bean="hibernateTemplate" />
    </property>
    </bean>

    ... other DAO with same hibernateTemplate

    Cold you help me to improve the performance?

  • #2
    Please use [ code][/code ] tags when posting code.
    1. Configure transactions
    2. Don't use hibernatetemplate use the sessionfactory together with getCurrentSession
    3. Your c3p0 settings in the hibernate config are useless, you are injecting a datasource
    4. Which datasource are you using
    5. How are you exactly using this from the web application (show dao code)

    Comment


    • #3
      First of all thanks a lot

      This is the full application context I'm using

      [ code]
      <?xml version = '1.0' encoding = 'UTF-8'?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

      <!-- Datasource -->
      <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">


      <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />

      <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" />
      <property name="username" value="user" />
      <property name="password" value="pwd" />

      </bean>

      <!-- Hibernate Session factory -->
      <bean id="mySessionFactory"
      class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
      <property name="dataSource" ref="myDataSource" />
      <property name="mappingResources">
      <list>
      <value>
      osservatorio/persistance/mapping/Osservatorio.hbm.xml
      </value>
      </list>
      </property>
      <property name="hibernateProperties">
      <props>
      <prop key="connection.provider_class">org.hibernate.conn ection.C3P0ConnectionProvider</prop>
      <prop key="hibernate.c3p0.max_size">5</prop>
      <prop key="hibernate.c3p0.max_statements">5</prop>
      <prop key="hibernate.c3p0.min_size">1</prop>
      <prop key="hibernate.c3p0.timeout">100</prop>
      <prop key="hibernate.c3p0.autoCommitOnClose">true</prop>
      <prop key="hibernate.c3p0.acquireRetryDelay">1000</prop>
      <prop key="hibernate.c3p0.acquireRetryAttempts">60</prop>
      <prop key="hibernate.c3p0.breakAfterAcquireFailure">fals e</prop>
      <prop key="hibernate.c3p0.acquire_increment">1</prop>
      <prop key="hibernate.c3p0.idle_test_period">100</prop> <!-- seconds -->
      <prop key="hibernate.c3p0.max_size">100</prop>
      <prop key="hibernate.c3p0.max_statements">0</prop>
      <prop key="hibernate.c3p0.min_size">10</prop>
      <prop key="hibernate.c3p0.timeout">100</prop>
      <prop key="hibernate.hbm2ddl.auto">update</prop>
      <prop key="hibernate.dialect">org.hibernate.dialect.Orac le10gDialect</prop>
      <prop key="hibernate.show_sql">false</prop>
      </props>
      </property>
      </bean>

      <bean id="myTxManager"
      class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
      <property name="sessionFactory" ref="mySessionFactory" />
      </bean>

      <!-- hibernateTemplate -->
      <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
      <property name="sessionFactory">
      <ref bean="mySessionFactory" />
      </property>
      </bean>

      <!-- Classi DAO -->
      <bean id="configDao" class="osservatorio.persistance.dao.impl.ConfigDao ">
      <property name="hibernateTemplate">
      <ref bean="hibernateTemplate" />
      </property>
      </bean>
      <bean id="userDao" class="osservatorio.persistance.dao.impl.UserDao">
      <property name="hibernateTemplate">
      <ref bean="hibernateTemplate" />
      </property>
      <property name="configDao">
      <ref bean="configDao" />
      </property>
      </bean>
      <bean id="gestioneAbusiDao" class="osservatorio.persistance.dao.impl.GestioneA busiDao">
      <property name="hibernateTemplate">
      <ref bean="hibernateTemplate" />
      </property>
      <property name="configDao">
      <ref bean="configDao" />
      </property>
      <!--
      <property name="sessionFactory">
      <ref bean="mySessionFactory" />
      </property>
      -->
      </bean>
      <bean id="schedeDao" class="osservatorio.persistance.dao.impl.SchedeDao ">
      <property name="hibernateTemplate">
      <ref bean="hibernateTemplate" />
      </property>
      <property name="configDao">
      <ref bean="configDao" />
      </property>
      </bean>
      <bean id="monitorThreadDao" class="osservatorio.persistance.dao.impl.MonitorTh readDao">
      <property name="configDao">
      <ref bean="configDao" />
      </property>
      <property name="hibernateTemplate">
      <ref bean="hibernateTemplate" />
      </property>
      </bean>


      <!-- Service Objects -->
      <bean id="monitorService" class="osservatorio.business.service.impl.MonitorS ervice">
      <property name="monitorThreadDao">
      <ref bean="monitorThreadDao" />
      </property>
      <property name="configDao">
      <ref bean="configDao" />
      </property>
      </bean>
      <bean id="userService" class="osservatorio.business.service.impl.UserServ ice">
      <property name="dao">
      <ref bean="userDao" />
      </property>
      <property name="regioneDefault">
      <value type="java.lang.String" >UMBRIA</value>
      </property>
      </bean>
      <bean id="gestioneAbusiService" class="osservatorio.business.service.impl.Gestione AbusiService">
      <property name="dao">
      <ref bean="gestioneAbusiDao" />
      </property>
      </bean>
      <bean id="schedeService" class="osservatorio.business.service.impl.SchedeSe rvice">
      <property name="dao">
      <ref bean="schedeDao" />
      </property>
      <property name="configDao">
      <ref bean="configDao" />
      </property>
      </bean>

      </beans>
      [/code ]

      If i understood you seggest to inject the session factory; I already tried it without big advantages. But I will try again

      You also suggest to use transaction: this I didn't try. This what i do

      Code:
      			String sqlQuery = "select distinct pratica from PraticaBean as pratica " +
      			"left join fetch pratica.zona " +
      			"left join fetch pratica.dettagliPratica " +
      			"left join fetch pratica.abusi abuso " +
      			"left join fetch abuso.caratteristiche " +
      			"left join fetch abuso.naturaDelVincolo " +
      			"left join fetch abuso.comunicante " +
      			"left join fetch abuso.interessato " +
      			"left join fetch abuso.utente " +
      			"left join fetch abuso.pratica " +
      			"left join fetch abuso.stato " +
      			"left join fetch abuso.zonaOmogenea " +
      			"left join fetch abuso.paragrafo " +
      			"left join fetch abuso.paragrafo.articolo " +
      			"left join fetch abuso.particelleCatastali " + 	 	
      			"left join fetch abuso.soggetti ";
      
      		List<PraticaBean> lstPratica = (List<RowPraticaBean>) hibernateTemplate.find(sqlQuery);
      Could you post how I can configure the transaction and how can I use it?

      Really many thanks for your support

      Nicola

      Comment


      • #4

        First of all thanks a lot

        This is the full application context I'm using

        Code:
        <?xml version = '1.0' encoding = 'UTF-8'?>
        <beans xmlns="http://www.springframework.org/schema/beans"
        	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        	xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
        
        	<!-- Datasource -->
        	<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
        
        
        		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
        
        	    <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" /> 
        	    <property name="username" value="user" />
        	    <property name="password" value="pwd" />
        
        	</bean>
        
        	<!-- Hibernate Session factory -->
        	<bean id="mySessionFactory"
        		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        		<property name="dataSource" ref="myDataSource" />
        		<property name="mappingResources">
        			<list>
        				<value>
        					osservatorio/persistance/mapping/Osservatorio.hbm.xml
        				</value>
        			</list>
        		</property>
        		<property name="hibernateProperties">
        			<props>
        				<prop key="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>
        				<prop key="hibernate.c3p0.max_size">5</prop>
        				<prop key="hibernate.c3p0.max_statements">5</prop>
        				<prop key="hibernate.c3p0.min_size">1</prop>
        				<prop key="hibernate.c3p0.timeout">100</prop>
        				<prop key="hibernate.c3p0.autoCommitOnClose">true</prop>
        				<prop key="hibernate.c3p0.acquireRetryDelay">1000</prop>
        				<prop key="hibernate.c3p0.acquireRetryAttempts">60</prop>
        				<prop key="hibernate.c3p0.breakAfterAcquireFailure">false</prop>
        				<prop key="hibernate.c3p0.acquire_increment">1</prop>
        				<prop key="hibernate.c3p0.idle_test_period">100</prop> <!-- seconds -->
        				<prop key="hibernate.c3p0.max_size">100</prop>
        				<prop key="hibernate.c3p0.max_statements">0</prop>
        				<prop key="hibernate.c3p0.min_size">10</prop>
        				<prop key="hibernate.c3p0.timeout">100</prop>
        				<prop key="hibernate.hbm2ddl.auto">update</prop>
        				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
        				<prop key="hibernate.show_sql">false</prop>
        					</props>
        		</property>
        	</bean>
        
        	<bean id="myTxManager"
        		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        		<property name="sessionFactory" ref="mySessionFactory" />
        	</bean>
        
        	<!-- hibernateTemplate -->
        	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        		<property name="sessionFactory">
        			<ref bean="mySessionFactory" />
        		</property>
        	</bean>
        	
        	<!-- Classi DAO -->
        	<bean id="configDao" class="osservatorio.persistance.dao.impl.ConfigDao">
        		<property name="hibernateTemplate">
        			<ref bean="hibernateTemplate" />
        		</property>
        	</bean>
        	<bean id="userDao" class="osservatorio.persistance.dao.impl.UserDao">
        		<property name="hibernateTemplate">
        			<ref bean="hibernateTemplate" />
        		</property>
        		<property name="configDao">
        			<ref bean="configDao" />
        		</property>
        	</bean>
        	<bean id="gestioneAbusiDao" class="osservatorio.persistance.dao.impl.GestioneAbusiDao">
        		<property name="hibernateTemplate">
        			<ref bean="hibernateTemplate" />
        		</property>
        		<property name="configDao">
        			<ref bean="configDao" />
        		</property>
        <!--
         		<property name="sessionFactory">
        			<ref bean="mySessionFactory" />
        		</property>
         -->		
        	</bean>
        	<bean id="schedeDao" class="osservatorio.persistance.dao.impl.SchedeDao">
        		<property name="hibernateTemplate">
        			<ref bean="hibernateTemplate" />
        		</property>
        		<property name="configDao">
        			<ref bean="configDao" />
        		</property>
        	</bean>
        	<bean id="monitorThreadDao" class="osservatorio.persistance.dao.impl.MonitorThreadDao">
            <property name="configDao">
              <ref bean="configDao" />
            </property>
        		<property name="hibernateTemplate">
        			<ref bean="hibernateTemplate" />
        		</property>
        	</bean>
        
        
        	<!-- Service Objects -->
        	<bean id="monitorService" class="osservatorio.business.service.impl.MonitorService">
        		<property name="monitorThreadDao">
        			<ref bean="monitorThreadDao" />
        		</property>
        		<property name="configDao">
        			<ref bean="configDao" />
        		</property>
        	</bean>
        	<bean id="userService" class="osservatorio.business.service.impl.UserService">
        		<property name="dao">
        			<ref bean="userDao" />
        		</property>
        		<property name="regioneDefault">
        			<value type="java.lang.String" >UMBRIA</value>
        		</property>
        	</bean>
        	<bean id="gestioneAbusiService" class="osservatorio.business.service.impl.GestioneAbusiService">
        		<property name="dao">
        			<ref bean="gestioneAbusiDao" />
        		</property>
        	</bean>
        	<bean id="schedeService" class="osservatorio.business.service.impl.SchedeService">
        		<property name="dao">
        			<ref bean="schedeDao" />
        		</property>
        		<property name="configDao">
        			<ref bean="configDao" />
        		</property>
        	</bean>
        
        </beans>
        If i understood you seggest to inject the session factory; I already tried it without big advantages. But I will try again

        You also suggest to use transaction: this I didn't try. This what i do

        Code:
        			String sqlQuery = "select distinct pratica from PraticaBean as pratica " +
        			"left join fetch pratica.zona " +
        			"left join fetch pratica.dettagliPratica " +
        			"left join fetch pratica.abusi abuso " +
        			"left join fetch abuso.caratteristiche " +
        			"left join fetch abuso.naturaDelVincolo " +
        			"left join fetch abuso.comunicante " +
        			"left join fetch abuso.interessato " +
        			"left join fetch abuso.utente " +
        			"left join fetch abuso.pratica " +
        			"left join fetch abuso.stato " +
        			"left join fetch abuso.zonaOmogenea " +
        			"left join fetch abuso.paragrafo " +
        			"left join fetch abuso.paragrafo.articolo " +
        			"left join fetch abuso.particelleCatastali " + 	 	
        			"left join fetch abuso.soggetti ";
        
        		List<PraticaBean> lstPratica = (List<RowPraticaBean>) hibernateTemplate.find(sqlQuery);
        Could you post how I can configure the transaction and how can I use it?

        Really many thanks for your support

        Nicola

        Comment


        • #5
          So many join fetchs definitely will give you a performance issue.

          Comment


          • #6
            http://www.javalobby.org/articles/hibernate-query-101/

            Comment


            • #7
              Hi all thanks for you reply,

              Yes I know the query is long and with a several fetch it can have performance issue but my problem is different: why the same query with same db and mapping takes 300 msec using plain hibernate or 70sec using spring hibernateTemplate

              I repeat here the two piece of code

              Plain Hibernate:

              Code:
              	Configuration conf = new Configuration();
              	conf.configure();
              	SessionFactory sessionFactory = conf.buildSessionFactory();
              			 
              	session =sessionFactory.openSession();
              
              	String sqlQuery = "select distinct pratica from PraticaBean as pratica " +
              			"left join fetch pratica.zona " +
              			"left join fetch pratica.dettagliPratica " +
              			"left join fetch pratica.abusi abuso " +
              			"left join fetch abuso.caratteristiche " +
              			"left join fetch abuso.naturaDelVincolo " +
              			"left join fetch abuso.comunicante " +
              			"left join fetch abuso.interessato " +
              			"left join fetch abuso.utente " +
              			"left join fetch abuso.pratica " +
              			"left join fetch abuso.stato " +
              			"left join fetch abuso.zonaOmogenea " +
              			"left join fetch abuso.paragrafo " +
              			"left join fetch abuso.paragrafo.articolo " +
              			"left join fetch abuso.particelleCatastali " + 	 	
              			"left join fetch abuso.soggetti ";		
              		
              		Query query = session.createQuery(sqlQuery);
              
              		long t1 = Calendar.getInstance().getTimeInMillis();
              		List<PraticaBean> lst = query.list();
              		long t2 = Calendar.getInstance().getTimeInMillis();
              
              		System.out.println("Elapsed time milliseconds: " + String.valueOf( t2 - t1 ) );
              Spring + HibernateTemplate (hibernateTemplate is injected by spring)

              Code:
              	String sqlQuery = "select distinct pratica from PraticaBean as pratica " +
              			"left join fetch pratica.zona " +
              			"left join fetch pratica.dettagliPratica " +
              			"left join fetch pratica.abusi abuso " +
              			"left join fetch abuso.caratteristiche " +
              			"left join fetch abuso.naturaDelVincolo " +
              			"left join fetch abuso.comunicante " +
              			"left join fetch abuso.interessato " +
              			"left join fetch abuso.utente " +
              			"left join fetch abuso.pratica " +
              			"left join fetch abuso.stato " +
              			"left join fetch abuso.zonaOmogenea " +
              			"left join fetch abuso.paragrafo " +
              			"left join fetch abuso.paragrafo.articolo " +
              			"left join fetch abuso.particelleCatastali " + 	 	
              			"left join fetch abuso.soggetti ";
              
              		long t1 = Calendar.getInstance().getTimeInMillis();
              		List<PraticaBean> lstPratica = (List<RowPraticaBean>) hibernateTemplate.find(sqlQuery);
              		long t2 = Calendar.getInstance().getTimeInMillis();
              
              		System.out.println("Elapsed time milliseconds: " + String.valueOf( t2 - t1 ) );
              Really, I don't understand ...

              Nicola

              Comment


              • #8
                I also tried to inject session factory and use the transaction,

                this what I did

                Application Context:

                Code:
                <?xml version = '1.0' encoding = 'UTF-8'?>
                <beans xmlns="http://www.springframework.org/schema/beans"
                	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                	xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
                
                	<!-- Datasource -->
                	<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
                
                
                		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
                 	 
                	    <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" /> 
                	    <property name="username" value="user" />
                	    <property name="password" value="password" />
                
                	</bean>
                
                	<!-- Hibernate Session factory -->
                	<bean id="mySessionFactory"
                		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                		<property name="dataSource" ref="myDataSource" />
                		<property name="mappingResources">
                			<list>
                				<value>
                					osservatorio/persistance/mapping/Osservatorio.hbm.xml
                				</value>
                			</list>
                		</property>
                		<property name="hibernateProperties">
                			<props>
                
                				<prop key="hibernate.hbm2ddl.auto">update</prop>
                				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                				<prop key="hibernate.show_sql">false</prop>
                
                				<prop key="hibernate.current_session_context_class">thread</prop>
                				<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop> 
                
                			</props>
                		</property>
                	</bean>
                
                	<!-- hibernateTemplate -->
                	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
                		<property name="sessionFactory">
                			<ref bean="mySessionFactory" />
                		</property>
                	</bean>
                	
                	<!-- Classi DAO -->
                	...
                	<bean id="gestioneAbusiDao" class="osservatorio.persistance.dao.impl.GestioneAbusiDao">
                		<property name="hibernateTemplate">
                			<ref bean="hibernateTemplate" />
                		</property>
                 		<property name="sessionFactory">
                			<ref bean="mySessionFactory" />
                		</property>		
                	</bean>
                	...
                
                </beans>
                I inject both hibernateTemplate and session factory my slow query now use session factory in this way

                Code:
                		Session session = sessionFactory.getCurrentSession();
                		session.beginTransaction();
                
                		String sqlQuery = "select distinct pratica from PraticaBean as pratica " +
                		"left join fetch pratica.zona " +
                		"left join fetch pratica.dettagliPratica " +
                		"left join fetch pratica.abusi abuso " +
                		"left join fetch abuso.caratteristiche " +
                		"left join fetch abuso.naturaDelVincolo " +
                		"left join fetch abuso.comunicante " +
                		"left join fetch abuso.interessato " +
                		"left join fetch abuso.utente " +
                		"left join fetch abuso.pratica " +
                		"left join fetch abuso.stato " +
                		"left join fetch abuso.zonaOmogenea " +
                		"left join fetch abuso.paragrafo " +
                		"left join fetch abuso.paragrafo.articolo " +
                		"left join fetch abuso.particelleCatastali " + 	 	
                		"left join fetch abuso.soggetti ";
                
                		Query query = session.createQuery(sqlQuery);
                		
                		
                		long t1 = Calendar.getInstance().getTimeInMillis();
                
                		Object obj = query.list();
                				
                		long t2 = Calendar.getInstance().getTimeInMillis();
                		System.out.println("query.list:" + (t2-t1) + "(ms)");
                The performance are still the same (very slow)

                Nicola

                Comment


                • #9
                  For starters DON'T use the 'current_session_context_class' and 'transaction.factory_class' properties unless you use JTA else it will screw up tx management.

                  Next to that DON'T mess around with transactions, spring will handle that for you, don't do it yourself at least not in this way.

                  Instead of posting code snippets, can you post some full code (maybe a stripped down version in a test project).

                  Comment


                  • #10
                    Nicola, some things to consider:
                    Are you sure the two cases you are comparing (standalone and with spring) do the same thing? For example, sometimes it happens that the query itself is much faster than retrievig data and building output - especially if query returns many rows. So check if the numer of matched records is the same in both cases, and if you really retrieve objects in both cases (not only ids, for example). And one more, very important thing - lazy relationships. It can be that you have some lazy relationships fetched in the second case. Turn on the logging of SQL statements to the console, to see what SQLs are really run.
                    If all of this doesn't help, then you can always start the profiler - then you will probably directly see where the problem comes from.

                    Comment


                    • #11
                      Hi thanks a lot for your answer,

                      I've enabled the shw_sql and the sql traced by hibernate is the same in both case.

                      Sure I have a lot of rows about 20K but i can't explain this difference.

                      I prepared a test that show this behaviour but i don't know how to share with the "kind" people who wants to help me

                      Nicola

                      Comment


                      • #12
                        Zip the files and attach it to a post.

                        Comment


                        • #13
                          Try using the profiler. It should given you the direct answer - it will show you were most of the time is spent in the code. I don't know what IDE you use. For profiling, I always used Netbeans - it has built-in profiler, easy to use, and it worked great for me, helped me many times.

                          Comment


                          • #14
                            I have something wrong with my web application:

                            To create the zip to share with you I created from scratch another web application. Here the spring + hibernate performance are reasonable 500 msec.

                            The application context is simplified, I have only one object where I inject the hibernateTemplate and I have few jar (only the package necesssary for hibernate and spring).

                            What could be the problem? Thread?

                            Thanks again for your patience

                            Nicola

                            Comment


                            • #15
                              Solved !!!

                              After some day of fighting I fix the problem.

                              It was very stupid: jta_1.1.jar was missing from my web abb: now everithin work fine!

                              Many thanks to every body for the support

                              Nicola

                              Comment

                              Working...
                              X