1.建表

create
table student

(sid
varchar (
32 )
not
null
primary
key ,

sname
varchar (
16 ),

sage
varchar (
16 ),

)

create
table course

(cid
varchar (
32 )
not
null
primary
key ,

cname
varchar (
16 )

)

create
table student_course_link

(sid
varchar (
32 )
not
null ,

cid
varchar (
32 )
not
null ,

primary
key (sid,cid)

)
2.写VO
StudentVO
Course vo
写配置文件
Student.hbm.xml
Course.hbm.xml
接着把下面的hibernate.properties文件拷到classes目录下。。这里用的是mysql

hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'

## MySQL

hibernate.dialect net.sf.hibernate.dialect.MySQLDialect

hibernate.connection.driver_class org.gjt.mm.mysql.Driver

hibernate.connection.url jdbc:mysql://localhost:3306/wjcms

hibernate.connection.username root

hibernate.connection.password wujun

hibernate.connection.pool_size 1

hibernate.proxool.pool_alias pool1

hibernate.show_sql true

hibernate.jdbc.batch_size 0

hibernate.max_fetch_depth 1

hibernate.cache.use_query_cache true
写测试类了..
好。。可以了。。