spring 整合hiberante如何取得设置的hibernateProperties

Spring2.5 整合 Hibernate3 时,我想在dao中取得配置文件中设置的hibernateProperties , 找了很久都没找到方法.

配置如下:

Java 代码
  1. "sessionFactory"   
  2.     class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean" >  
  3.     "dataSource"  ref= "dataSource"  />  
  4.     "lobHandler"  ref= "lobHandler"  />  
  5.   
  6.     "mappingDirectoryLocations" >  
  7.           
  8.             WEB-INF/classes/com/etone/solid/po/  
  9.           
  10.       
  11.     "hibernateProperties " >  
  12.           
  13.             "hibernate.dialect" >  
  14.                 org.hibernate.dialect.SybaseDialect  
  15.               
  16.             "hibernate.show_sql" > true   
  17.             "hibernate.format_sql" > true   
  18.             "hibernate.cache.use_query_cache" > true   
  19.             "hibernate.jdbc.fetch_size" > 50   
  20.             "hibernate.jdbc.batch_size" > 0   
  21.             "use_streams_for_binary" > true   
  22.             "hibernate.cache.provider_class" >  
  23.                 org.hibernate.cache.EhCacheProvider  
  24.               
  25.             "hibernate.query.factory_class" >  
  26.                 org.hibernate.hql.classic.ClassicQueryTranslatorFactory  
  27.               
  28.             "hibernate.generate_statistics" > true   
  29.             "hibernate.connection.release_mode" >  
  30.                 auto  
  31.               
  32.               
  33.               
  34.           
  35.       
  36.   
  37.     "eventListeners" >  
  38.           
  39.             "merge" >  
  40.                 
  41.                     class = "org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"  />  
  42.               
  43.           
  44.       
  45.   
	
		
		

		
			
				WEB-INF/classes/com/etone/solid/po/
			
		
		hibernateProperties
">
			
				
					org.hibernate.dialect.SybaseDialect
				
				true
				true
				true
				50
				0
				true
				
					org.hibernate.cache.EhCacheProvider
				
				
					org.hibernate.hql.classic.ClassicQueryTranslatorFactory
				
				true
				
					auto
				
				
				
			
		

		
			
				
					
				
			
		
	



谢谢哪位帮忙回答一下
问题补充:
我拿到的sessionFactory是 org.hibernate.SessionFactory,

我看了下,org.springframework.orm.hibernate3.LocalSessionFactoryBean才有 getHibernateProperties方法.

我怎么才能得到org.springframework.orm.hibernate3.LocalSessionFactoryBean实例 呢?
问题补充:
to lovewhzlq:
得到工厂本身的话,就注入"&sessionFactory"
我这样写:

Java 代码
  1. "daoSupport"   
  2.     class = "com.etone.common.dao.impl.DaoSupportHibernate3Impl" >  
  3.     "sessionFactory" >  
  4.         "&sessionFactory"  />  
  5.       
  6.   
	
		
			
		
	


报错:

Java 代码
  1. org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line  207  in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The reference to entity  "sessionFactory"  must end with the  ';'  delimiter.  
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 207 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The reference to entity "sessionFactory" must end with the ';' delimiter.

你可能感兴趣的:(J2SE,-,JAVA基础,spring,hibernate,exception,reference,java,nested)