`
xly_971223
  • 浏览: 1263140 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

hibernate annotations和hbm.xml配置文件并存配置

阅读更多
<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="mappingResources">
			<list>
				<value>/com/yese/domain/Bulletin.hbm.xml</value>
				<value>/com/yese/domain/User.hbm.xml</value>
				<value>/com/yese/domain/RoleProgram.hbm.xml</value>
				<value>/com/yese/domain/Role.hbm.xml</value>
				<value>/com/yese/domain/QuestionOption.hbm.xml</value>
				<value>/com/yese/domain/Question.hbm.xml</value>
				<value>/com/yese/domain/ProgramRecommend.hbm.xml</value>
				<value>/com/yese/domain/ProgramPhase.hbm.xml</value>
				<value>/com/yese/domain/ProgramDownloadLog.hbm.xml</value>
				<value>/com/yese/domain/ProgramCategory.hbm.xml</value>
				<value>/com/yese/domain/Program.hbm.xml</value>
				<value>/com/yese/domain/Mail.hbm.xml</value>
				<value>/com/yese/domain/ArticleCategory.hbm.xml</value>
			</list>
		</property>
		
		<property name="annotatedClasses">
			<list>
				<value>com.yese.domain.Article</value>
			</list>
		</property>

		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.query.substitutions">true 1, false 0</prop>
				<prop key="hibernate.autoReconnect">true</prop>
				<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
				<prop key="hibernate.cache.use_query_cache">true</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.provider_class">com.yese.cache.memcached.MemcachedCacheProvider</prop>
                
                <prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
                <prop key="hibernate.search.default.indexBase">c:/indexes</prop>
                <!-- 
                <prop key="hibernate.search.analyzer"></prop>
                  -->
				
                <prop key="memcached.servers">192.168.1.32:12000</prop>
				<prop key="memcached.failover">true</prop>
				<prop key="memcached.initConn">10</prop>
				<prop key="memcached.minConn">10</prop>
				<prop key="memcached.maxConn">1000</prop>
				<prop key="memcached.maintSleep">30</prop>
				<prop key="memcached.nagle">false</prop>
				<prop key="memcached.socketTO">3000</prop>
				<prop key="memcached.aliveCheck">true</prop>
				
				<!-- memcached -->
				<!-- 
				<prop key="memcached.org.hibernate.cache.StandardQueryCache">30s</prop>
				<prop key="memcached.org.hibernate.cache.UpdateTimestampsCache">30s</prop>
				<prop key="memcached.com.yese.domain.Article">30s</prop>
				<prop key="memcached.com.yese.domain.Mail">30s</prop>
				 -->
			</props>
		</property>
	</bean>

<property name="mappingResources">指定映射文件
<property name="annotatedClasses">指定annotation类
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics