下面定义的两个 JPQL 查询,哪一个具有更有效的性能(在时间限制上)或者它们具有相同的性能 -
ParentEntity <=> ChildEntity [存在多对多关系]
SELECT me from ChildEntity me where me <> All(select me.childEntitiesRef from ParentEntity pe where pe.parentId=:parentId)
或者
SELECT me FROM ChildEntity me, ParentEntity pe WHERE me NOT MEMBER OF pe.childEntitiesRef AND pe.parentId=:parentId
class ParentEntity{
@Id
String parentId;
@ManyToMany
List<ChildEntity> childEntitiesRef;
}
class ChildEntity {
@Id
String childId;
}