Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql JPQL查询多通_Sql_Jpa_Jpa 2.0_Eclipselink_Jpql - Fatal编程技术网

Sql 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

针对多通单向和双向关系的JPQL查询

我需要JPQL查询来访问在单向和双向关系中未连接到特定父实体的所有子实体的列表

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)