Skip to content

Autodetect spring.jpa.database from spring.datasource.url - #7796

Closed
eddumelendez wants to merge 1 commit into
spring-projects:1.5.xfrom
eddumelendez:gh-7708
Closed

eddumelendez wants to merge 1 commit into
spring-projects:1.5.xfrom
eddumelendez:gh-7708

Conversation

@eddumelendez

Copy link
Copy Markdown
Contributor

Previously, property spring.jpa.database should be provided. This
commit allows to detect the database when spring.datasource.url is
provided.

See gh-7708

@snicoll

snicoll commented Dec 30, 2016

Copy link
Copy Markdown
Member

Gah Eddu, you beat me to it. Thanks!

@snicoll
snicoll self-requested a review December 30, 2016 17:57
@philwebb philwebb added this to the 1.5.0 RC1 milestone Dec 30, 2016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do you feel about retrieving the URL of the DataSource from the meta-data (like you did in that other PR). This avoid injecting another collaborator and would work for things where the url isn't defined (that's typically the case for auto-configured embedded databases).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should move that up and back-off if the DatabaseDriver is UNKNOWN.

Also, we need a better link between Database and DatabaseDriver. when I gave some thought to that issue, I was considering creating a mapping between a DatabaseDriver and a Database. I think it's better than relying on the fact they share the same name...

We probably need a test that iterates over Database values to make sure everything is covered somehow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah crap, ok. Now I get the name thing (I should have read everything)

I am not sure (yet) that we should add yet another attribute to that thing. Such soft link is not very interesting anyway. And there's only one user of it so I'd keep that mapping where the Database is determined.

@eddumelendez

Copy link
Copy Markdown
Contributor Author

@snicoll working on changes. Thanks for feedback

@eddumelendez
eddumelendez force-pushed the gh-7708 branch 2 times, most recently from 4c20ff5 to d96a300 Compare December 31, 2016 04:20
Previously, property `spring.jpa.database` should be provided. This
commit allows to detect the database when `spring.datasource.url` is
provided.

See spring-projectsgh-7708
snicoll added a commit that referenced this pull request Jan 3, 2017
* pr/7796:
  Polish contribution
  Autodetect spring.jpa.database from spring.datasource.url
@snicoll snicoll closed this in fe89af5 Jan 3, 2017
@snicoll

snicoll commented Jan 3, 2017 •

Copy link
Copy Markdown
Member

I did polish it a bit more, thanks Eddu!

@eddumelendez
eddumelendez deleted the gh-7708 branch January 17, 2018 13:39
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

Successfully merging this pull request may close these issues.

3 participants