Skip to content

Data/repository definition#205

Merged
rashidi merged 4 commits intomasterfrom
data/repository-definition
Mar 21, 2025
Merged

Data/repository definition#205
rashidi merged 4 commits intomasterfrom
data/repository-definition

Conversation

@rashidi
Copy link
Copy Markdown
Owner

@rashidi rashidi commented Mar 21, 2025

No description provided.

rashidi added 2 commits March 22, 2025 07:25
Introduce a new `data-repository-definition` module demonstrating
the use of `@RepositoryDefinition`. Refactor existing repositories
to use the annotation for cleaner and more focused APIs.
@rashidi rashidi added the enhancement New feature or request label Mar 21, 2025
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @rashidi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces a new module, data-repository-definition, which demonstrates the use of @RepositoryDefinition annotation in Spring Data. This annotation allows defining custom repository interfaces without extending standard Spring Data base interfaces like JpaRepository or CrudRepository. The module includes a simple Note entity and a NoteRepository interface that uses @RepositoryDefinition to define a custom findByTitleContainingIgnoreCase method. The pull request also includes necessary configurations, tests, and documentation to showcase the functionality.

Highlights

  • Repository Definition: Demonstrates the use of @RepositoryDefinition for creating custom Spring Data repositories.
  • Note Entity: Introduces a simple Note entity with id, title, and content fields.
  • Custom Query Method: Implements a custom findByTitleContainingIgnoreCase method in the NoteRepository.
  • Testcontainers Integration: Includes integration tests using Testcontainers for PostgreSQL to verify the repository functionality.
  • Documentation: Adds a README file explaining the purpose and usage of @RepositoryDefinition with examples.

Changelog

Click here to see the changelog
  • data-domain-events/src/main/java/zin/rashidi/boot/data/de/availability/BookAvailabilityRepository.java
    • Reordered the import statements to adhere to conventional style, placing org.springframework imports before java.util imports.
  • data-repository-definition/.gitattributes
    • Added .gitattributes file to manage line endings for different file types (gradlew, bat, jar).
  • data-repository-definition/.gitignore
    • Added .gitignore file to exclude IDE-specific files, build artifacts, and other unnecessary files from version control.
  • data-repository-definition/README.adoc
    • Created a README file explaining the purpose of the module and how to use @RepositoryDefinition.
    • Includes sections on background, domain class, repository definition, benefits, testing, and conclusion.
  • data-repository-definition/build.gradle
    • Configured the Gradle build file with necessary plugins and dependencies.
    • Includes Spring Boot, data-jdbc, PostgreSQL, and Testcontainers dependencies.
    • Specifies Java language version 21.
  • data-repository-definition/settings.gradle
    • Configured the root project name for the Gradle project.
  • data-repository-definition/src/main/java/zin/rashidi/data/repositorydefinition/DataRepositoryDefinitionApplication.java
    • Created the main application class for the Spring Boot application.
  • data-repository-definition/src/main/java/zin/rashidi/data/repositorydefinition/note/Note.java
    • Defined the Note record with id, title, and content fields.
  • data-repository-definition/src/main/java/zin/rashidi/data/repositorydefinition/note/NoteRepository.java
    • Defined the NoteRepository interface using @RepositoryDefinition and a custom findByTitleContainingIgnoreCase method.
  • data-repository-definition/src/main/resources/application.properties
    • Set the spring.application.name property.
  • data-repository-definition/src/test/java/zin/rashidi/data/repositorydefinition/TestDataRepositoryDefinitionApplication.java
    • Created a test application class to run integration tests with Testcontainers.
  • data-repository-definition/src/test/java/zin/rashidi/data/repositorydefinition/TestcontainersConfiguration.java
    • Configured Testcontainers for PostgreSQL in a test configuration class.
  • data-repository-definition/src/test/java/zin/rashidi/data/repositorydefinition/note/NoteRepositoryTests.java
    • Implemented integration tests for the NoteRepository using @DataJdbcTest and Testcontainers.
    • Includes a test case for the findByTitleContainingIgnoreCase method.
  • settings.gradle
    • Included the data-repository-definition module in the main settings.gradle file.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A repository defined with grace,
Methods specific, set in place.
No need to extend,
Just what you intend,
A focused interface to embrace.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a new module data-repository-definition that demonstrates the use of @RepositoryDefinition annotation in Spring Data. The module includes a simple domain class, a repository definition, and a test case. The README provides a good explanation of the concept and usage. Overall, the code is well-structured and easy to understand.

Merge Readiness

The pull request is well-structured and includes a comprehensive README explaining the purpose and usage of the @RepositoryDefinition annotation. The included test case provides confidence in the functionality. I am unable to directly approve the pull request, and other reviewers should review and approve this code before merging. I recommend merging this pull request.

@rashidi rashidi merged commit 568bba3 into master Mar 21, 2025
4 checks passed
@rashidi rashidi deleted the data/repository-definition branch March 21, 2025 23:38
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant