问题标签 [query-derivation]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
426 浏览

java - Spring数据jpa方法查询findWith

最近,我遇到了这个 Spring Data JPA 存储库方法findWithBooksById

涉及的两个类非常基础:Library one-to-many Books,方法是查询图书馆及其书籍。

我查看了https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.details,但没有引用此方法模式(findWith...)。

查看生成的查询,它查询图书馆表并立即查询书籍。因此,如果我在查询后立即调用 getBooks findById(在这种情况下是惰性初始化的书籍),则连续调用两个查询。

有谁知道findWith...Spring Data JPA 的工作原理?

0 投票
1 回答
538 浏览

java - Spring Data JPA - 方法名称 - @ManyToOne

我有一个实体 CpoPipeline,它与 CpoEnvironment 的关系为 ManyToOne:

实体 CpoEnvironment:

此实体的存储库具有方法名称:

错误:原因:org.springframework.data.mapping.PropertyReferenceException:没有找到类型 CpoPipeline 的属性 environmentId

如何使用实体中的一个字段和关系中的一个字段创建方法名称?可能吗?

0 投票
1 回答
10 浏览

spring-data-jpa - 带有“集合属性中的参数”的 Sprig 数据派生方法名称

我有这个 JPA 实体

当特定的执行者附加到它们时,我需要我的 JpaRepository 为我获取所有的 todo 实例。

ie Iterable findAllByDoersContaining(String email) // 集合扫描

我会说,这与 findByOwnerIn(Collection doers) 完全相反。是否有可能实现该连接?

感谢您的任何提示。