@Entity设置OneToMany
2015-09-17 19:45
344 查看
Hibernate设置bean映射数据库的方式有配置模式与注解模式,下面通过注解模式配置OneToMany
鸣谢:http://bbs.csdn.net/topics/390522138
@Entity @Table(name="csdnbbs_sys_catalog") @org.hibernate.annotations.Proxy(lazy = false) public class Catalog { private Catalog parent ; private String id ; private String name ; private String url ; private Set<Catalog> children = new HashSet<Catalog>(); @OneToMany(cascade=CascadeType.ALL, mappedBy="parent") public Set<Catalog> getChildren() { return children; } public void setChildren(Set<Catalog> children) { this.children = children; } }
鸣谢:http://bbs.csdn.net/topics/390522138
相关文章推荐
- oracle 数据库无法启动,报错 terminating the instance due to error 16014
- 项目四——顺序表的运用(1)
- Android5.0源码开发之launcher切换语言后Folder和ShortcutT没有切换到当前语言
- 小马哥---高仿红米note刷机 主板型号m8207 4G版 4月版本白标拆机主板图与开机界面图
- 分割音视频,成独立的音频es数据和独立的视频es数据
- sql server 2000 单主键高效分页存储过程 (支持多字段排序)
- 通用跨站脚本攻击(UXSS)
- 算法系列-Remove Element
- Android开发环境的演变
- 读《大道至简----软件工程实践者的思想》有感
- 2015-09-17
- POJ 2201 Cartesian Tree 笛卡尔树
- mysql 查询问题集合
- 黑马程序员_关于path和classpath
- 字符串,字符数组,整型数组,List之间的转换应用
- 2015网易游戏笔试第一题(找9706的重复次数)
- 分页存储过程
- STL+sstream+统计单词数
- Understanding ActiveMQ Broker Networks - 理解ActiveMQ 网络模型
- C#实现字符串数组的TreeMap排序