---
title: "Spring整合hibernate配置模版"
author: "paddy.w"
date: "2011-04-12T20:14:55Z"
tags: ["Bean", "Hibernate", "ORM", "Spring", "XML"]
categories: ["企业架构"]
slug: "spring-hibernate"
draft: false
lastmod: "2011-04-12T20:59:30Z"
id: 1000313
url: "https://paddy-w.iteye.com/blog/1000313"
---

下面是用一个具体例子写的模版(支持annotation的配置)，需要时稍微改改就行： \[code="xml"] org.hibernate.dialect.MySQLDialect true com.test.bean.User \[/code] \[color=darkblue]被注释掉的部分是xxx.hbm.xml配置文件的设置。但是用于annotation的配置同样也可以用与hbm文件配置，\[/color]\[color=red]因为org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean继承了org.springframework.orm.hibernate3.LocalSessionFactoryBean。\[/color]