Announcement Announcement Module
Collapse
No announcement yet.
Confusion with making Hibernate 3.2 work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Confusion with making Hibernate 3.2 work

    Our project has been using Spring for some time now and we have decided to give Hibernate a go to simplify our dao layer. I have never touched Hibernate before and trying to get it to work with our existing framework has been a nightmare.

    This exception has held me up for a week now:
    "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"

    Here is a snapshot of a few files:

    spring config..
    Code:
    	<bean id="xxxManager"
    		class="xxxManagerImpl" parent="hibernateDaoSupport">
    		<property name="sessionFactory">
    			<ref local="sessionFactory"/>
    		</property>
    	</bean>
    
    	<!-- Hibernate SessionFactory -->
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref local="DataSource"/>
    		</property>
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    	</bean>
    
    	<bean id="hibernateDaoSupport" class="org.springframework.orm.hibernate3.support.HibernateDaoSupport"
    		abstract="true">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory"/>
    		</property>
    	</bean>
    	<bean id="TransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
    		singleton="true">
    		<property name="dataSource" ref="DataSource"/>
    	</bean>
    
    	<bean id="DataSource"
    		class="xxxx.DataSource"
    		destroy-method="close"
    		singleton="true">
    		<property name="dataSource">
    			<ref local="ConnectionPool"/>
    		</property>
    	</bean>
    hibernate.cfg.xml..
    Code:
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    
    <hibernate-configuration>
    
        <session-factory>
    
            <!-- SQL dialect -->
            <property name="dialect">org.hibernate.dialect.SybaseDialect</property>
    
            <!-- Enable Hibernate's automatic session context management -->
            <property name="current_session_context_class">thread</property>
    
            <!-- Disable the second-level cache  -->
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    
            <!-- Echo all executed SQL to stdout -->
            <property name="show_sql">true</property>
    
            <property name="hbm2ddl.auto">validate</property>
    
            <mapping resource="xxx.hbm.xml"/>
        </session-factory>
    
    </hibernate-configuration>
    The Manager extends HibernateDaoSupport and it blows up trying to do a Session session = getSessionFactory().getCurrentSession();

    I have seen a bunch of things talking about OpenSessionInViewFilter, what is this and do I need it?

    Any insight on where to go from here? I feel like I have to get some kinda transaction management working but the examples I have seen look far more involved than I think it should be. (see managerContext.xml at http://www.thearcmind.com/confluence...nd+MyFaces+JSF)
    If that model is correct I have hundreds of <bean id="rssManager" parent="txProxyTemplate"> things to write. Which removes a lot of the desirability of Hibernate for me.

    Sorry for the scrubbed classnames.

  • #2
    First off all start by getting your configuration right?!

    1) remove the current_session_context_class from your configuration, spring already handles that for you, if you override it it won't work.

    2) use the correct transaction manager HibernateTransactionManager instead of the datasource one, you are using Hibernate. It also works with plain jdbc

    3) it is advised not to use the HibernateDaoSupport and/or HibernateTemplate, use the SessionFactory directly (blog post)



    TransactionManager
    Code:
    <bean id="TransactionManager" class="HibernateTransactionManager">
    	<property name="sessionFactory" ref="SessionFactory" />
    	<property name="dataSource" ref="DataSource"/>
    </bean>
    Configuratoin
    Code:
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    
    <hibernate-configuration>
    
        <session-factory>
    
            <!-- SQL dialect -->
            <property name="dialect">org.hibernate.dialect.SybaseDialect</property>
    
            <!-- Disable the second-level cache  -->
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    
            <!-- Echo all executed SQL to stdout -->
            <property name="show_sql">true</property>
    
            <property name="hbm2ddl.auto">validate</property>
    
            <mapping resource="xxx.hbm.xml"/>
        </session-factory>
    
    </hibernate-configuration>

    Comment


    • #3
      Thank you for the reply!

      Fixed the config and changed my java code to reflect that of Alef's blog. Still no dice. Good news is for whatever reason I fail extra fast now. Things used to take several seconds before blowing up, now its rather instant.

      application context...
      Code:
      	<!-- Hibernate SessionFactory -->
      	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      		<property name="dataSource">
      			<ref local="DataSource"/>
      		</property>
      		<property name="configLocation">
      			<value>classpath:hibernate.cfg.xml</value>
      		</property>
      	</bean>
      
      	<bean id="hibernateDaoSupport" class="org.springframework.orm.hibernate3.support.HibernateDaoSupport"
      		abstract="true">
      		<property name="sessionFactory">
      			<ref bean="sessionFactory"/>
      		</property>
      	</bean>
      
      	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      		<property name="sessionFactory">
      			<ref local="sessionFactory"/>
      		</property>
      		<property name="dataSource">
      			<ref local="DataSource"/>
      		</property>
      	</bean>
      
      	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
      hibernate.cfg.xml..
      Code:
          <session-factory>
              <!-- SQL dialect -->
              <property name="dialect">org.hibernate.dialect.SybaseDialect</property>
      
              <!-- Enable Hibernate's automatic session context management 
              <property name="current_session_context_class">thread</property> -->
              <!-- Disable the second-level cache  -->
              <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
              <!-- Echo all executed SQL to stdout -->
              <property name="show_sql">true</property>
              <property name="hbm2ddl.auto">validate</property>
              <mapping resource="xxx.hbm.xml"/>
          </session-factory>
      class file snipets..
      Code:
      @Repository
      public class xxxImpl implements xxx {
      
      //skip a bit, constructor, injected factory etc....
      
      	public xxx resolve(long id) throws Exception {
      		//code that brakes
      		Session session = factory.getCurrentSession();
      		session.beginTransaction();
      		Object result = session.get(xxx.class, id);
      		session.close();
      	}
      }
      I have nothing in the web.xml right now. Experimented with tons of things and I think at some point it was actually attaching sessions but I had 2 instances of spring running then. (Spring code lives in tomcat/common, not the webapps)

      Here is some of the debug output, not sure if it helps, but I find it odd that it opens the session and then immediately closes it.

      Code:
      03-Apr-2008 01:49:12 PM: [INFO] Hibernate 3.2.5
      03-Apr-2008 01:49:12 PM: [INFO] hibernate.properties not found
      03-Apr-2008 01:49:12 PM: [INFO] Bytecode provider name : cglib
      03-Apr-2008 01:49:12 PM: [INFO] using JDK 1.4 java.sql.Timestamp handling
      03-Apr-2008 01:49:12 PM: [INFO] configuring from url: file:/C:/programs/Tomcat5/common/classes/hibernate.cfg.xml
      03-Apr-2008 01:49:12 PM: [INFO] Reading mappings from resource : xxx.hbm.xml
      03-Apr-2008 01:49:12 PM: [INFO] Mapping class: xxx -> xxx
      03-Apr-2008 01:49:12 PM: [INFO] Configured SessionFactory: null
      03-Apr-2008 01:49:12 PM: [INFO] Building new Hibernate SessionFactory
      03-Apr-2008 01:49:13 PM: [INFO] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
      03-Apr-2008 01:49:13 PM: *** Active=0/22 Idle=1/0/5
      03-Apr-2008 01:49:13 PM: *** abcDataSource.setUsers(): user from ThreadLocal=superuser;
      03-Apr-2008 01:49:13 PM: [INFO] RDBMS: sql server, version: 12.50
      03-Apr-2008 01:49:13 PM: [INFO] JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
      03-Apr-2008 01:49:13 PM: [INFO] Using dialect: org.hibernate.dialect.SybaseDialect
      03-Apr-2008 01:49:13 PM: [INFO] Using default transaction strategy (direct JDBC transactions)
      03-Apr-2008 01:49:13 PM: [INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
      03-Apr-2008 01:49:13 PM: [INFO] Automatic flush during beforeCompletion(): disabled
      03-Apr-2008 01:49:13 PM: [INFO] Automatic session close at end of transaction: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Scrollable result sets: enabled
      03-Apr-2008 01:49:13 PM: [INFO] JDBC3 getGeneratedKeys(): enabled
      03-Apr-2008 01:49:13 PM: [INFO] Connection release mode: on_close
      03-Apr-2008 01:49:13 PM: [INFO] Default batch fetch size: 1
      03-Apr-2008 01:49:13 PM: [INFO] Generate SQL with comments: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Order SQL updates by primary key: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Order SQL inserts for batching: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
      03-Apr-2008 01:49:13 PM: [INFO] Using ASTQueryTranslatorFactory
      03-Apr-2008 01:49:13 PM: [INFO] Query language substitutions: {}
      03-Apr-2008 01:49:13 PM: [INFO] JPA-QL strict compliance: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Second-level cache: enabled
      03-Apr-2008 01:49:13 PM: [INFO] Query cache: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Cache provider: org.hibernate.cache.NoCacheProvider
      03-Apr-2008 01:49:13 PM: [INFO] Optimize cache for minimal puts: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Structured second-level cache entries: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Echoing all SQL to stdout
      03-Apr-2008 01:49:13 PM: [INFO] Statistics: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Deleted entity synthetic identifier rollback: disabled
      03-Apr-2008 01:49:13 PM: [INFO] Default entity-mode: pojo
      03-Apr-2008 01:49:13 PM: [INFO] Named query checking : enabled
      03-Apr-2008 01:49:13 PM: [INFO] building session factory
      03-Apr-2008 01:49:13 PM: [INFO] Not binding factory to JNDI, no JNDI name configured
      03-Apr-2008 01:49:13 PM: [INFO] Running schema validator
      03-Apr-2008 01:49:13 PM: [INFO] fetching database metadata
      03-Apr-2008 01:49:13 PM: *** Active=0/22 Idle=1/1/5
      03-Apr-2008 01:49:13 PM: *** abcDataSource.setUsers(): user from ThreadLocal=superuser;
      03-Apr-2008 01:49:13 PM: [INFO] table found: xxx
      03-Apr-2008 01:49:13 PM: [INFO] columns: [lets just say a whole lot]
      03-Apr-2008 01:49:13 PM: [TRACE] Getting BeanInfo for class [xxx]
      03-Apr-2008 01:49:13 PM: [TRACE] Caching PropertyDescriptors for class [xxx]
      03-Apr-2008 01:49:13 PM: [TRACE] Found bean property 'class' of type [java.lang.Class]
      03-Apr-2008 01:49:13 PM: [TRACE] Found bean property 'sessionFactory' of type [org.hibernate.SessionFactory]
      03-Apr-2008 01:49:13 PM: [DEBUG] Opening Hibernate Session
      03-Apr-2008 01:49:13 PM: [DEBUG] Closing Hibernate Session
      Again sorry for the scrubbs, and I could not post more logs, hit a 10k char limit.

      Comment


      • #4
        You now have a transaction manager however you have no transaction configuration. Annotate your Dao with @Transactional and include <tx:annotation-driven /> in your application context (make sure you also include the namespace etc.).

        Next to that DON'T do any transaction managememt/session management yourself, let spring handle it, that is why you have spring configured.

        Code:
        @Repository
        @Transactional
        public class xxxImpl implements xxx {
        
        //skip a bit, constructor, injected factory etc....
        
        	public xxx resolve(long id) throws Exception {
        		//code that brakes
        		Session session = factory.getCurrentSession();
        		Object result = session.get(xxx.class, id);
        		return result;
        	}
        }
        This probably will get it to work. However in the future you want to remove the @Transactional from your Repository/Dao layer and move it up to the Service layer (you want your business method to be transactional).

        Comment


        • #5
          Thanks again for the help. Things still are not working yet, but I feel like I have made leaps and bounds as far as cleanliness and understanding of the code goes.

          I updated the app context.xml with the <tx:annotation-driven /> and brought the xml up to 2.0 standards (migrating off 1.2 still). I separated things out into a Manager that has @Transactional and a dao with @Repository taking in a sessionFactory. Hibernate.cfg.xml is the same, context has the changes mentioned. Did I have to do anything to the Manager bean in the context? From what I read here (http://static.springframework.org/sp...ansaction.html) I did not think I had to.

          context.xml...
          Code:
          <beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:tx="http://www.springframework.org/schema/tx"
                 xsi:schemaLocation="
                 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
          
          	<tx:annotation-driven />
          	<bean id="xxxDAO"
          		class="xxxDAOImpl">
          		<property name="dataSource">
          			<ref local="DataSource"/>
          		</property>  	
          		<property name="sessionFactory">
          			<ref local="sessionFactory"/>
          		</property>
          	</bean>
          	<bean id="xxxManager"
          		class="xxxManagerImpl">
          	</bean>
          
          	<!-- Hibernate SessionFactory -->
          	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
          		<property name="dataSource">
          			<ref local="DataSource"/>
          		</property>
          		<property name="configLocation">
          			<value>classpath:hibernate.cfg.xml</value>
          		</property>
          	</bean>
          
          	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
          		<property name="sessionFactory">
          			<ref local="sessionFactory"/>
          		</property>
          		<property name="dataSource">
          			<ref local="DataSource"/>
          		</property>
          	</bean>
          
          	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
          Thanks again for the assistance.

          Comment


          • #6
            Can you post your Manager...

            How are you calling a method on the manager?

            Comment


            • #7
              Heres the manager:
              Code:
              import org.springframework.transaction.annotation.Transactional;
              
              @Transactional
              public class xxxManagerImpl implements xxxManager {
              	//constructor, injected dao, etc
              
              	public xxx resolve(long id) throws Exception {
              		return dao.resolve(id);
              	}
              }
              Dao:
              Code:
              import org.hibernate.Session;
              import org.hibernate.SessionFactory;
              import org.springframework.stereotype.Repository;
              
              @Repository
              public class xxxDAOImpl extends DAO implements xxxDAO {
              
              	private SessionFactory factory;
              	public void setSessionFactory(SessionFactory factory) {
              		this.factory = factory;
              	}
              
              	public xxx resolve(long id) throws Exception {
              		Session session = factory.getCurrentSession();
              		session.beginTransaction();
              		Object result = session.get(xxx.class, id);
              		session.close();
              
              		if(result != null)
              			return (xxx)result;
              		return null;
              	}//end resolve()
              And I am calling this via a jsp page that is a searchable listing of xxx. This is the path that has one in particular that its looking for as opposed to the generic query.
              Code:
              	xxxManager xMan = (xxxManager)SpringManager.getBean("xxxManager");
              	xxx = xMan.resolve(id);
              Could this have anything to do with spring not being in the webapp? My context.xml is not in the web.xml or anything spring related for that matter. Perhaps I have separate threads running, a webapp jsp thread and then a general tomcat/common thread?

              Thanks again for all the assistance!

              Comment


              • #8
                Made some progress. Was reading here: http://www.hibernate.org/207.html Which talked about threading problems with the hibernate session. So shortcutting their helper class I used sf.openSession() instead of sf.getCurrentSession() and Hibernate fired.

                Now this means that I would have a new session every time I ran something so the transactional stuff goes out the window using this method does it not?

                I think the Helper class seems like a reasonable solution, do you see any issues with doing something this way? I am still unsure if I should be having this problem at all and I just have not configured something correctly yet.

                Comment


                • #9
                  Don't use the helper class.. READ my post.

                  1) DON'T do transaction management yourself, let spring do it.
                  2) DON'T do session management yourself, let spring do it.

                  As I said in 2 post earlier.

                  For 1. remove the session.beginTransaction.
                  For 2. remove the session.close.

                  Read my posts....

                  Comment


                  • #10
                    Sorry, was an airhead last week I guess =/

                    Did as you said, took the beginTransaction() and session.close() out of the DAO. Things do not work if I try to use sf.getCurrentSession(), still the same old No session bound to thread deal. However using openSession() is running fine. But that wont do transactions since I would be gaining new sessions all the time then right?

                    I may run like this for a while just to get most of the stuff done but I do need to figure out why I never have a current session. Any ideas on how to approach that? I cannot find a nice way to poll the sf to ask what state it is in.

                    Thanks again for all the help, things have moved faster in this last week then it has all month.

                    Comment


                    • #11
                      Also while using openSession my spring connection pool is filling. Was not paying attention to it until I turned on sessionfactory statistics. This is what last came out before my 22 connection pool filled up.

                      Code:
                      07-Apr-2008 05:45:01 PM: [INFO] Logging statistics....
                      07-Apr-2008 05:45:01 PM: [INFO] start time: 1207604264740
                      07-Apr-2008 05:45:01 PM: [INFO] sessions opened: 21
                      07-Apr-2008 05:45:01 PM: [INFO] sessions closed: 0
                      07-Apr-2008 05:45:01 PM: [INFO] transactions: 0
                      07-Apr-2008 05:45:01 PM: [INFO] successful transactions: 0
                      07-Apr-2008 05:45:01 PM: [INFO] optimistic lock failures: 0
                      07-Apr-2008 05:45:01 PM: [INFO] flushes: 0
                      07-Apr-2008 05:45:01 PM: [INFO] connections obtained: 22
                      07-Apr-2008 05:45:01 PM: [INFO] statements prepared: 23
                      07-Apr-2008 05:45:01 PM: [INFO] statements closed: 23
                      07-Apr-2008 05:45:01 PM: [INFO] second level cache puts: 0
                      07-Apr-2008 05:45:01 PM: [INFO] second level cache hits: 0
                      07-Apr-2008 05:45:01 PM: [INFO] second level cache misses: 0
                      07-Apr-2008 05:45:01 PM: [INFO] entities loaded: 3406
                      07-Apr-2008 05:45:01 PM: [INFO] entities updated: 0
                      07-Apr-2008 05:45:01 PM: [INFO] entities inserted: 0
                      07-Apr-2008 05:45:01 PM: [INFO] entities deleted: 0
                      07-Apr-2008 05:45:01 PM: [INFO] entities fetched (minimize this): 0
                      07-Apr-2008 05:45:01 PM: [INFO] collections loaded: 1
                      07-Apr-2008 05:45:01 PM: [INFO] collections updated: 0
                      07-Apr-2008 05:45:01 PM: [INFO] collections removed: 0
                      07-Apr-2008 05:45:01 PM: [INFO] collections recreated: 0
                      07-Apr-2008 05:45:01 PM: [INFO] collections fetched (minimize this): 1
                      07-Apr-2008 05:45:01 PM: [INFO] queries executed to database: 21
                      07-Apr-2008 05:45:01 PM: [INFO] query cache puts: 0
                      07-Apr-2008 05:45:01 PM: [INFO] query cache hits: 0
                      07-Apr-2008 05:45:01 PM: [INFO] query cache misses: 0
                      07-Apr-2008 05:45:01 PM: [INFO] max query time: 485ms
                      I guess spring cannot close a session thats been forced open?

                      Comment


                      • #12
                        I think I have to get out of the idea of it being multiple threads giving me issues with the sf.getCurrentSession(). I stuck code in the jsp, manager and DAO to give me Thread info and here was what I got.

                        Code:
                        code:
                        System.out.println("JSP thread: " + (java.lang.management.ManagementFactory.getThreadMXBean().getThreadInfo(Thread.currentThread().getId())).toString());
                        
                        results:
                        JSP thread: Thread http-443-Processor24 (Id = 61) RUNNABLE null
                        Manager thread: Thread http-443-Processor24 (Id = 61) RUNNABLE null
                        DAO thread: Thread http-443-Processor24 (Id = 61) RUNNABLE null

                        Comment


                        • #13
                          I guess spring cannot close a session thats been forced open?
                          Spring cannot close sessions that it doesn't know of, or in other words session opened by you should be closed by you. I.e. don't use openSession....

                          Comment


                          • #14
                            Yea finally understand that too. I am somewhat stuck on where to go with this. I cannot find any meaningful reason as to why it is not working. I have proof that im in the same thread the entire time, I get given a sessionFactory that works fine forcing open sessions, and I have Transactions working correctly. I am currently re-reading the spring and hibernate ref's looking for clues. I am close to compiling spring with debug lines turned on so I can trace the thing better. Is there some sessionFactory property I have missed? Does having a custom datasource based off AbstractDataSource do anything to the sessionFactory?

                            Is there more areas I can debug?

                            [edit] the forum update email said you wanted the spring debug, here is as much as I can paste:
                            Code:
                            08-Apr-2008 02:41:07 PM: [TRACE] Getting BeanInfo for class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]
                            08-Apr-2008 02:41:07 PM: [TRACE] Caching PropertyDescriptors for class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'cacheableMappingLocations' of type [[Lorg.springframework.core.io.Resource;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'class' of type [java.lang.Class]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'collectionCacheStrategies' of type [java.util.Properties]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'configLocation' of type [org.springframework.core.io.Resource]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'configuration' of type [org.hibernate.cfg.Configuration]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'configurationClass' of type [java.lang.Class]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'dataSource' of type [javax.sql.DataSource]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'entityCacheStrategies' of type [java.util.Properties]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'entityInterceptor' of type [org.hibernate.Interceptor]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'eventListeners' of type [java.util.Map]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'exposeTransactionAwareSessionFactory' of type [boolean]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'filterDefinitions' of type [[Lorg.hibernate.engine.FilterDefinition;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'hibernateProperties' of type [java.util.Properties]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'jtaTransactionManager' of type [javax.transaction.TransactionManager]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'lobHandler' of type [org.springframework.jdbc.support.lob.LobHandler]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'mappingDirectoryLocations' of type [[Lorg.springframework.core.io.Resource;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'mappingJarLocations' of type [[Lorg.springframework.core.io.Resource;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'mappingLocations' of type [[Lorg.springframework.core.io.Resource;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'mappingResources' of type [[Ljava.lang.String;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'namingStrategy' of type [org.hibernate.cfg.NamingStrategy]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'object' of type [java.lang.Object]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'objectType' of type [java.lang.Class]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'schemaUpdate' of type [boolean]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'singleton' of type [boolean]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'typeDefinitions' of type [[Lorg.springframework.orm.hibernate3.TypeDefinitionBean;]
                            08-Apr-2008 02:41:07 PM: [TRACE] Found bean property 'useTransactionAwareDataSource' of type [boolean]
                            08-Apr-2008 02:41:07 PM: [TRACE] Converting String to [interface org.springframework.core.io.Resource] using property editor [org.springframework.core.io.ResourceEditor@ad5fab]
                            08-Apr-2008 02:41:07 PM: [INFO] Hibernate 3.2.5
                            08-Apr-2008 02:41:07 PM: [INFO] hibernate.properties not found
                            08-Apr-2008 02:41:07 PM: [INFO] Bytecode provider name : cglib
                            08-Apr-2008 02:41:07 PM: [INFO] using JDK 1.4 java.sql.Timestamp handling
                            08-Apr-2008 02:41:07 PM: [INFO] configuring from url: file:/C:/programs/Tomcat5/common/classes/hibernate.cfg.xml
                            08-Apr-2008 02:41:07 PM: [INFO] Reading mappings from resource : xxx.hbm.xml
                            08-Apr-2008 02:41:07 PM: [INFO] Mapping class: xxx -> xxx
                            08-Apr-2008 02:41:08 PM: [INFO] Reading mappings from resource : xxxService.hbm.xml
                            08-Apr-2008 02:41:08 PM: [INFO] Mapping class: xxxService -> xxx_service
                            08-Apr-2008 02:41:08 PM: [INFO] Configured SessionFactory: null
                            08-Apr-2008 02:41:08 PM: [INFO] Building new Hibernate SessionFactory
                            08-Apr-2008 02:41:08 PM: [INFO] Mapping collection: xxx.services -> xxx_service
                            08-Apr-2008 02:41:08 PM: [INFO] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
                            08-Apr-2008 02:41:08 PM: *** Active=0/22 Idle=1/0/5
                            08-Apr-2008 02:41:08 PM: *** xxxDataSource.setUsers(): user from ThreadLocal=superuser;
                            08-Apr-2008 02:41:08 PM: [INFO] RDBMS: sql server, version: 12.50
                            08-Apr-2008 02:41:08 PM: [INFO] JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
                            08-Apr-2008 02:41:08 PM: [INFO] Using dialect: org.hibernate.dialect.SybaseDialect
                            08-Apr-2008 02:41:08 PM: [INFO] Using default transaction strategy (direct JDBC transactions)
                            08-Apr-2008 02:41:08 PM: [INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
                            08-Apr-2008 02:41:08 PM: [INFO] Automatic flush during beforeCompletion(): disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Automatic session close at end of transaction: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Scrollable result sets: enabled
                            08-Apr-2008 02:41:08 PM: [INFO] JDBC3 getGeneratedKeys(): enabled
                            08-Apr-2008 02:41:08 PM: [INFO] Connection release mode: on_close
                            08-Apr-2008 02:41:08 PM: [INFO] Default batch fetch size: 1
                            08-Apr-2008 02:41:08 PM: [INFO] Generate SQL with comments: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Order SQL updates by primary key: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Order SQL inserts for batching: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
                            08-Apr-2008 02:41:08 PM: [INFO] Using ASTQueryTranslatorFactory
                            08-Apr-2008 02:41:08 PM: [INFO] Query language substitutions: {}
                            08-Apr-2008 02:41:08 PM: [INFO] JPA-QL strict compliance: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Second-level cache: enabled
                            08-Apr-2008 02:41:08 PM: [INFO] Query cache: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Cache provider: org.hibernate.cache.NoCacheProvider
                            08-Apr-2008 02:41:08 PM: [INFO] Optimize cache for minimal puts: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Structured second-level cache entries: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Echoing all SQL to stdout
                            08-Apr-2008 02:41:08 PM: [INFO] Statistics: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Deleted entity synthetic identifier rollback: disabled
                            08-Apr-2008 02:41:08 PM: [INFO] Default entity-mode: pojo
                            08-Apr-2008 02:41:08 PM: [INFO] Named query checking : enabled
                            08-Apr-2008 02:41:08 PM: [INFO] building session factory
                            08-Apr-2008 02:41:08 PM: [INFO] Not binding factory to JNDI, no JNDI name configured
                            08-Apr-2008 02:41:08 PM: [INFO] Running schema validator
                            08-Apr-2008 02:41:08 PM: [INFO] fetching database metadata
                            08-Apr-2008 02:41:08 PM: *** Active=0/22 Idle=1/1/5
                            08-Apr-2008 02:41:08 PM: *** xxxDataSource.setUsers(): user from ThreadLocal=superuser;
                            08-Apr-2008 02:41:08 PM: [INFO] table found: xxx
                            08-Apr-2008 02:41:08 PM: [INFO] columns: [lots of columns]
                            08-Apr-2008 02:41:08 PM: [INFO] table found: xxx_service
                            08-Apr-2008 02:41:08 PM: [INFO] columns: [lots of columns]
                            08-Apr-2008 02:41:09 PM: [TRACE] Getting BeanInfo for class [xxxDAOImpl]
                            08-Apr-2008 02:41:09 PM: [TRACE] Caching PropertyDescriptors for class [xxxDAOImpl]
                            08-Apr-2008 02:41:09 PM: [TRACE] Found bean property 'class' of type [java.lang.Class]
                            08-Apr-2008 02:41:09 PM: [TRACE] Found bean property 'dataSource' of type [javax.sql.DataSource]
                            08-Apr-2008 02:41:09 PM: [TRACE] Found bean property 'sessionFactory' of type [org.hibernate.SessionFactory]
                            08-Apr-2008 02:41:09 PM: [DEBUG] Eagerly caching bean 'xxxManager' to allow for resolving potential circular references
                            08-Apr-2008 02:41:09 PM: [DEBUG] Opening Hibernate Session
                            08-Apr-2008 02:41:09 PM: [DEBUG] Closing Hibernate Session
                            08-Apr-2008 02:41:09 PM: [DEBUG] Returning cached instance of singleton bean 'DataSource'
                            Last edited by gman; Apr 8th, 2008, 02:45 PM.

                            Comment


                            • #15
                              Hi Marten,

                              Can you post the URLs to ur post where you were saying:
                              1) DON'T do transaction management yourself, let spring do it.
                              2) DON'T do session management yourself, let spring do it.

                              Thanks?

                              Comment

                              Working...
                              X