spring-projects / spring-projects/spring-data-commons

Improve parser for derived queries so properties starting with "is" become usable. [DATACMNS-1761]

Open
#2,177 4 comments 0 reactions 1 assignee View on GitHub

@mp911de is already working on this.

Since Dec 30, 2020.

in: repository type: enhancement
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

Hayk Avetisyan opened DATACMNS-1761 and commented

Given the following example entity:

@Entity
public class CountryNode {
   @Id
   @GeneratedValue(generator = "uuid2")
   @GenericGenerator(name = "uuid2", strategy = "uuid2")
   private UUID id;
   @OneToOne
   @JoinColumn(name = "country_id")
   private Country country;
}


@Entity public class Country {
   private String iso2;
}

When I create a Jpa Repository Function to find all entities by a property of the relation:

 

@Repository
public interface CountryNodeRepository extends JpaRepository<CountryNode, UUID> {
   List<CountryNode> findAllByCountryIso2(String countryIso2);
}

Then it doesn't work

(if it was findAllByCountryIno2, it would work)

It works for findAllByCountry_Iso2(String countryIso2). But this is not the desired way for cases where there is, for instance, a SonarQube rule that does not allow/recommend to use underscores in function names.

 


No further details from DATACMNS-1761

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.