@IdClass @IdClass 联合主键的 警告
来源:互联网 发布:html编辑器源码 编辑:程序博客网 时间:2024/04/27 19:14
运行下:结果杯具了:20:55:57,078 WARN RootClass:215 - composite-id class does not override hashCode(): com.fendou.hibernate.SalDate
这句话告诉我们联合主键composite-id标签要求SalDate重写equals和hashCode方法.同时我们还需要实现Serializable接口。为什么要重写这两个方法以及实现Serializable
重写equals和hashCode方法是为了唯一确定一条记录以便用来作为持久化对象的标识。在Hibernate中要求一个标识必须是持久化的,所以必须将salDate实现Serializable接口。
帮助文档是这样说的:Unfortunately, this approach tocomposite identifiers means that a persistent object is its own identifier. There is no convenient "handle" other than the object itself. You must instantiate an instance of the persistent class itself and populate its identifier properties before you can load() the persistent state associated with a composite key.
上面那段英文中的后半部分是教我们怎么进行查询,在查询的时候我们先持久化一个主键对象标识然后查询:
- @IdClass @IdClass 联合主键的 警告
- 复合主键的配置 @idClass
- 复合主键@IdClass
- JPA 主键@Id、@IdClass、@Embeddable、@EmbeddedId
- JPA 菜鸟教程 12 复合主键-2个@Id+@IdClass
- 同时使用@IdClass @ManyToOne碰到的一个问题
- Hibernate @IdClass @EmbeddedID相关注解
- 联合主键的使用
- Hibernate的联合主键
- hibernate的联合主键
- JPA 的联合主键
- Mysql的联合主键
- Mysql的联合主键
- hibernate的联合主键
- 持久化API(JPA)系列(七)实体关系映射(ORM)之单表映射@IdClass
- 持久化API(JPA)系列(七)实体关系映射(ORM)之单表映射@IdClass
- oracle 主键删除,联合主键的创建
- JPACompositePK联合主键的操作
- android 5.0 获取 当前app包名
- Android启动过程中背景图片显示
- 从浏览器到服务器 网站是如何工作的
- Live555本地保存H264/PCM视频音频帧附加SPS/PPS
- join
- @IdClass @IdClass 联合主键的 警告
- python urllib2登录并用Ghost获取js渲染之后的数据
- iOS开发中的随机数
- 【Python拾遗】目录操作
- 解决WebView加载URL跳转到系统浏览器的问题
- iframe子页面调用父页面javascript函数的方法
- 自己写的小代码有用 以后还能用上
- C#控件之PropertyGrid
- 农民工欠款方LED大屏幕讨薪:还钱天经地义(图