hibernate对应关系
2015-07-01 16:43
357 查看
1.@ManyToOne
数据表中记录外键值。
receiver
@NotFound(action=NotFoundAction.IGNORE),意思是找不到引用的外键数据时忽略。
cusomizationInfo
member
2.@ManyToMany
promotion(促销)
member(会员)
数据表中记录外键值。
receiver
/** * 获取地区 * @return 地区 */ @NotNull @ManyToOne(fetch = FetchType.LAZY) @NotFound(action=NotFoundAction.IGNORE) public Area getArea() { return area; }
@NotFound(action=NotFoundAction.IGNORE),意思是找不到引用的外键数据时忽略。
cusomizationInfo
/** * 获取发件人 * * @return 发件人 */ @JoinColumn(updatable = false) @ManyToOne(fetch = FetchType.LAZY) public Member getSender() { return sender; }
member
/** * 获取职业 * * @return 返回 occupation */ @ManyToOne(fetch = FetchType.LAZY) public Occupation getOccupation() { return occupation; }
2.@ManyToMany
promotion(促销)
@ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "xx_promotion_brand") public Set<Brand> getBrands() { return brands; }
member(会员)
/** * 获取收藏商品 * * @return 收藏商品 */ @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "xx_member_favorite_product") @OrderBy("createDate desc") public Set<Product> getFavoriteProducts() { return favoriteProducts; }
相关文章推荐
- Flume NG之Interceptor简介
- Hash table 学习笔记
- Codeforces Round #311 (Div. 2)
- Flume NG之Interceptor简介
- 站在巨人的肩膀上,C++开源库大全
- iOS开发搜集的一些资料
- ArduinoYun教程之配置Arduino Yun环境
- 在 Windows 上安装Rabbit MQ 指南
- Linux 学习 00 系统启动流程
- 重构网络库
- vim的命令集合
- oracle 联表更新
- 字符串匹配的KMP算法
- 欢迎使用CSDN-markdown编辑器
- Android使用NDK---函数参数传递-基本类型和数组
- KMP模式匹配算法
- CSS3小分队——进击的border-radius
- KMP模式匹配算法 分类: C/C++ 2015-07-01 16:41 150人阅读 评论(0) 收藏
- [NEWS]Microsoft expands partnerships with AOL and AppNexus, Bing to power search for AOL properties
- Smarty最简单实现列表奇偶变色的方法