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

Should we have support to configuration #22

Closed
otaviojava opened this issue Sep 22, 2022 · 5 comments
Closed

Should we have support to configuration #22

otaviojava opened this issue Sep 22, 2022 · 5 comments
Labels
vote Something to vote on wontfix This will not be worked on
Milestone

Comments

@otaviojava
Copy link
Contributor

Once we're talking about data sources, it is natural to have settings such as user, password, and so on.

My question is: should we have support or a convention about configuration on this version?

Example

Quarkus

JPA

# datasource configuration
quarkus.datasource.db-kind = postgresql
quarkus.datasource.username = hibernate
quarkus.datasource.password = hibernate
quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/hibernate_db

# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.database.generation=drop-and-create

Mongodb

# configure the mongoDB client for a replica set of two nodes
quarkus.mongodb.connection-string = mongodb://mongo1:27017,mongo2:27017

# configure the mongoDB client for a single instance on localhost
quarkus.mongodb.connection-string = mongodb://localhost:27017

Spring

JPA

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpass
spring.datasource.url= jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true

MongoDB

spring.data.mongodb.uri=mongodb+srv://<username>:<pwd>@<cluster>.mongodb.net/mygrocerylist
spring.data.mongodb.database=mygrocerylist

Micronaut

JPA

jpa.default.properties.hibernate.hbm2ddl.auto= update
jpa.default.properties.hibernate.hbm2ddl.show_sql=true
@otaviojava otaviojava added this to the Jakarta Data 1.0 milestone Sep 22, 2022
@otaviojava otaviojava added the vote Something to vote on label Sep 22, 2022
@njr-11
Copy link
Contributor

njr-11 commented Sep 22, 2022

+1 to supporting configuration.
We also need to consider that in a Jakarta EE environment, many users of relational databases/Jakarta Persistence are using data sources either configured by vendor-specific means or DataSourceDefinition, and are possibly accessed through resource references, and possibly with support for forms of authentication beyond just basic user/password. The granularity of some of these existing definitions concerns me (for example java:comp names that mean different things based on which component does the lookup) with respect to a repository that is shared across the whole application or even multiple applications.

There could also be multiple data sources and/or multiple Jakarta NoSQL providers pointing at different databases, so configuration might be needed on a per-repository basis rather than system wide (although the latter would certainly be more convenient).

I wonder if we should have a way to configure a system-wide default for relational and default for NoSQL, and then additional configurations that repositories could optionally point at if not wanting the default.

Configuration will be a difficult area to get right, but an important one.

@keilw
Copy link
Member

keilw commented Sep 26, 2022

We shall use Jakarta Configuration once that produced a Final Release or at least Stable Milestone.

@graemerocher
Copy link
Contributor

This seems beyond the scope IMO and is a slippery slope given how many different databases and use cases are out there

@gavinking
Copy link
Contributor

I agree with @graemerocher on this. I think this is out of scope for a "repository" spec, would offer little real portability, and risk making configuration even more complicated.

@otaviojava
Copy link
Contributor Author

Ok, I will close this issue as it won´t fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vote Something to vote on wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants