有三个类,分别对应三个表ComAuthPermissionDO、ComAuthOperationDO、ComAuthEntityDO
三个表的关系是:ComAuthPermissionDO分别引用了ComAuthOperationDO、ComAuthEntityDO,即分别跟这两个表形成@ManyToOne关系。
在查询ComAuthPermissionDO,可以联级查到ComAuthOperationDO、ComAuthEntityDO,但非常奇怪,我查出来之后,发现ComAuthOperationDO的equals()方法总是返回false,最后发现,是equals方法在对比两个类的Class时候返回false。于是打印了联级查询的这两个实例的Class:
=============.>>CLass: com.xx.component.authorization.model.ComAuthOperationDO$$EnhancerByCGLIB$$86a21bfb
=============.>>CLass: com.xx.component.authorization.model.ComAuthEntityDO
为什么Hibernate加载ComAuthOperationDO实例时用来CGLIB动态代理,而加载ComAuthEntityDO时却正常呢?
请解答。。。谢谢!