简体   繁体   English

Spring Data JPA查询

[英]Spring Data JPA Query

I have 3 entities in my Database. 我的数据库中有3个实体。 Entity A has primary key PK-A, Entity B has primary key PK-B, Entity C has primary key PK-C. 实体A具有主键PK-A,实体B具有主键PK-B,实体C具有主键PK-C。

在此处输入图片说明

Entity A has 1 to many relation with Entity B and Entity B has one to many relation with Entity C 实体A与实体B有一对多关系,而实体B与实体C有一对多关系

I want to query Entity C based on PK-A (which is actually the Foreign Key in Entity B) in Spring Data JPA. 我想在Spring Data JPA中基于PK-A(实际上是实体B中的外键)查询实体C。 Is it possible? 可能吗?

I tried using the following: 我尝试使用以下内容:

findByTableB_FK-A findByTableB_FK-A

But this does not work. 但这是行不通的。 Any other suggestion that I can try? 还有其他建议可以尝试吗?

The correct method signature is 正确的方法签名是

TableC findByFK-BFK-A(TableA tableA);

but notice, the - is not allowed in method-names. 但通知, -是不是在方法,名称中不允许。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM