首页 > Web开发 > 详细

hibernate学习:HelloWorld_Annotation

时间:2015-02-05 14:58:47      阅读:294      评论:0      收藏:0      [点我收藏+]

一:HelloWorld注解实现

技术分享


二:程序源码


三:Console输出

Hibernate: insert into Teacher (name, title, id) values (?, ?, ?)

四:知识总结

  与 HibernateHelloWorld_xml不用的是:
(1)model中使用了@Entity @Table @id @Column等注解,映射跟表的关系

(2)Hibernate配置文件中映射实体,用class属性
   <mapping class="com.hibernate.model.Teacher" />

  (3)单元测试中,解析配置文件的时候,用的是AnnotationConfiguration
Configuration cfg = new AnnotationConfiguration();

hibernate学习:HelloWorld_Annotation

原文:http://blog.csdn.net/u013628152/article/details/43527711

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!