Skip to content
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

Confusing error message if using @Repository in a JDBC project #3290

Open
mikehearn opened this issue Jan 15, 2025 · 0 comments
Open

Confusing error message if using @Repository in a JDBC project #3290

mikehearn opened this issue Jan 15, 2025 · 0 comments

Comments

@mikehearn
Copy link

Expected Behavior

The error should say something like:

Cannot use a repository annotated with @Repository in a JDBC project, please use @JdbcRepository(dialect = ...) instead.

Actual Behaviour

The Micronaut Data docs are a bit confusing w.r.t. how to annotate repository interfaces. The docs start by saying (under "shared concepts") that you have to annotate them with @Repository which makes sense, but in fact if you use JDBC directly (no JPA/Hibernate) the repository must be annotated with @JdbcRepository. This is explained later but it's easy to miss and if you do, you get an exception with a message like this:

No backing RepositoryOperations configured for repository. Check your configuration and try again

This is pretty confusing. The problem isn't in the app config file, it's not clear what a "backing RepositoryOperations" is or why none is configured, and the generic "check your configuration and try again" advice is so vague it's nearly non-actionable.

Steps To Reproduce

  1. Set up a JDBC only Micronaut Data project.
  2. Write a repository that inherits from e.g. GenericRepository and is annotated using @Repository
  3. Run the app.
  4. Be puzzled by the resulting message.

Environment Information

No response

Example Application

No response

Version

4.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant