Open distinctdan opened 1 day ago
Allow me to walk through my experience as a new user to help you guys better understand my journey through the site. I'm documenting this to help you understand my user flow, so that you guys can make the docs easier to use:
micronaut-data
. I immediately see a bunch of stuff about history and a changelog, which I don't care about as a new user.Build Configuration
section which looks like what I want, to figure out how to install it and configure it.Build Configuration
and add the dependency annotationProcessor("io.micronaut.data:micronaut-data-processor")
.3.1 Repository Interfaces
and start trying to create a @Repository
.Good feedback. The docs have an "Improve this doc" link above each section, perhaps you would like to contribute to add clarity to areas you think are lacking?
Thanks, I might be open to updating docs, but I still haven't gotten this working yet. It may be better to have someone with more domain knowledge do it if anyone is available. The current error I'm running into is the same as this issue: https://github.com/micronaut-projects/micronaut-data/pull/197. Here are my dependencies for micronaut-data, not sure what I'm missing yet:
annotationProcessor("io.micronaut.data:micronaut-data-processor")
implementation("io.micronaut.data:micronaut-data-jdbc")
compileOnly("jakarta.persistence:jakarta.persistence-api")
You would also need a JDBC driver and a JDBC pool
Thanks, ok, I've got it working now, it looks like @Repository
isn't compatible with JDBC, you have to set up JPA instead I think. This is the kind of thing where maybe I've gotten it working, but I would rather someone with more experience with the project do the documentation for how it's supposed to be set up for each use case. I just don't have the domain knowledge of how it's supposed to be used. Here's an example of what I ended up with. FYI my team prefers native SQL over JPA because many of our queries have a lot of joins, even though this example is simpler.
@JdbcRepository(dialect = Dialect.POSTGRES)
interface PostgresAmendmentDao : GenericRepository<AmendmentRequest, Long> {
@Query("""
SELECT *,
fk_bulk_amendment as bulk_amendment_id,
fk_response_id as response_id,
fk_waiver_id as waiver_id
FROM assessment.amendment_request
WHERE id in (:ids)
""", nativeQuery = true)
fun getAmendmentRequests(ids: List<Long>): List<AmendmentRequest>
}
we have many good guides on the topic with associated sample code like https://guides.micronaut.io/latest/micronaut-data-jdbc-repository.html and https://guides.micronaut.io/latest/micronaut-data-one-to-many.html perhaps links to those would have helped
So I've read the guides, but unfortunately there are a couple of problems with using the guides as documentation:
I would ask that the micronaut-data developers figure out which packages are required, and which are optional. Then, place that information in a dependencies list at the beginning of the docs. If there are multiple routes a user can take, clearly state that they must pick 1, and clearly list the dependencies for that route. Here are the Compose docs as an example, I think it would be good if the micronaut docs were more like this for the installation instructions: https://developer.android.com/develop/ui/compose/setup
Expected Behavior
I'm trying to add micronaut-data to an existing project. The docs say to add the following to gradle, which doesn't work:
I'm getting the error
Unresolved reference: Repository
when I try to add the@Repository
annotation to an interface. The docs mention a runtime dependency, but they don't tell what it is. This is basic stuff guys, I shouldn't have to do an hour of research to figure out all of the required packages, this needs to be in the docs. The docs seem to assume that you're going to regenerate a new micronaut starter project every time, which isn't convenient at all.After further research, it looks like there are a variety of possible dependencies scattered throughout the docs. These should all be moved to up at the top under the
Build Configuration
heading, and it should be clearly stated that you have to install one of them. As a user, I should be able to install micronaut-data and start using it quickly, without having to read and understand the entire documentation. There needs to be a "getting started" section that clearly states what you need to do to install it and get started, just like most other libraries.Actual Behaviour
The docs should correctly state how to install micronaut-data.
Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
Latest