-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clarification]: Clarification and Restriction on Non-Built Repositories and Methods by Query #755
Comments
In the preamble of ch4 we say:
I agree that this passage could be improved and made much more explicit (and, in particular However, it is actually well-defined, I think: For Note that there is additional language in section 5.5.1 for JDQL, and in 4.3 for parameter-based automatic query methods, and in the Javadoc for the |
If we agree, this test at TCK does not make sense: data/tck/src/main/java/ee/jakarta/tck/data/standalone/entity/EntityTests.java Lines 1382 to 1386 in 78d5340
I mean, related to those two methods here: data/tck/src/main/java/ee/jakarta/tck/data/framework/read/only/CustomRepository.java Lines 37 to 39 in 78d5340
How should I know the entities that those methods are talking about? |
@otaviojava the entity type for those methods is the primary entity type of the repository, as defined in the preamble of ch4. (Last regular paragraph of page 19, just before the admonition.) |
I got that, but once it is a custom repository it does not provide this.
This code from TCK does not provide the primary entity of the repository. @Repository
public interface CustomRepository {
long countByIdIn(Set<Long> ids);
boolean existsByIdIn(Set<Long> ids);
} Sorry, maybe I am losing some details. |
Did you read the paragraph I referenced? |
That's not the whole code for |
I did not mention those methods because those are fine based on what we have in the documentation, as you said here: Thus, those methods have the primary entity: @Insert
void add(List<NaturalNumber> list);
@Delete
void remove(List<NaturalNumber> list); But I am not talking about those, but the findBy, existsBy or countBy in the same context. |
Otavio, I think you have the concept backwards. Life cycle methods, such as with
|
It is what it is. |
Specification
https://github.com/jakartaee/data/blob/main/spec/src/main/asciidoc/method-query.asciidoc#query-by-method-name
I need clarification on ...
There seems to be an inconsistency or lack of clarity regarding the use of non-built repositories, especially when using query methods other than
findBy
. While thefindBy
action clearly identifies the entity type through its return type, this is not the case for other actions such asexistsBy
orcountBy
.Examples:
For the
findBy
action, it's clear which entity is being queried:In this case, the return type
List<Person>
clearly indicates that the entity isPerson
.However, for other actions such as
existsBy
orcountBy
, the entity type is not as clear:Here, we do not have any perspective on the entity in this query.
Proposed Solutions:
Restrict these query methods to built-in repositories only:
Example:
Additional information
No response
The text was updated successfully, but these errors were encountered: