Sql JPQL查询多通
针对多通单向和双向关系的JPQL查询 我需要JPQL查询来访问在单向和双向关系中未连接到特定父实体的所有子实体的列表Sql JPQL查询多通,sql,jpa,jpa-2.0,eclipselink,jpql,Sql,Jpa,Jpa 2.0,Eclipselink,Jpql,针对多通单向和双向关系的JPQL查询 我需要JPQL查询来访问在单向和双向关系中未连接到特定父实体的所有子实体的列表 Example - For ParentEntity[p11,p21] get All other disconnected List of ChildEntity([c12,c22],[c13,c23]) 致以最良好的祝愿, Gaurav Gupta。感谢您的回复,我已经更新了关于复合密钥实体的问题,您是否可以在复合密钥案例中帮助我使用查询选择c from ChildEnti
Example -
For ParentEntity[p11,p21] get All other disconnected List of ChildEntity([c12,c22],[c13,c23])
致以最良好的祝愿,
Gaurav Gupta。感谢您的回复,我已经更新了关于复合密钥实体的问题,您是否可以在复合密钥案例中帮助我使用查询选择c from ChildEntity c其中c!=从ParentEntity p中选择p.childEntityRef,其中p.parentId=:parentId
select c from ChildEntity c where c.childId != (
select p.childEntityRef.childId from ParentEntity p where p.parentId = :parentId)
_______________________________________________________________________
|| ParentEntity Table || ChildEntity Table ||
||_________________________________________||__________________________||
parentId1|parentId2|childId1_FK|childId1_FK|| childId1| childId2 ||
||_______|_________|___________|___________||_________|________________||
|| p11 |p21 | c11 |c21 || c11 | c21 ||
|| p12 |p22 | c11 |c21 || c12 | c22 ||
|| p13 |p23 | c12 |c22 || c13 | c23 ||
|| p14 |p24 | c12 |c22 || | ||
||_______|_________|___________|___________||_________|________________||
Example -
For ParentEntity[p11,p21] get All other disconnected List of ChildEntity([c12,c22],[c13,c23])
select c from ChildEntity c where c.childId != (
select p.childEntityRef.childId from ParentEntity p where p.parentId = :parentId)