求用hibernate annotation做的完整案例

来源:百度知道 编辑:UC知道 时间:2024/06/05 10:02:49
要是用◎OneToMany写的,至少要三张表关联,最好是用hibernate,spring,struts做的由底层到顶层的那种。 不要太简单。谢谢先!

2,基本的一些过程如下:

3,首先要引入支持包,Spring Core ,Spring Persistence Core,Spring AOP,还要引入Commons Pool。
4, 然后从配置文件开始:

myspringcontext.xml: 对于原来的Hibernate配置文件,我采取了保留原来配置的方法,因为在Spring中配置Hibernate的一些属性感觉不方便。
内容如下:

<?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">