Skip to content

EntityManagerFactoryBuilder cannot be used as advertised #10068

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

Closed
odrotbohm opened this issue Aug 24, 2017 · 3 comments
Closed

EntityManagerFactoryBuilder cannot be used as advertised #10068

odrotbohm opened this issue Aug 24, 2017 · 3 comments
Labels
type: enhancement A general enhancement

Comments

@odrotbohm
Copy link
Member

odrotbohm commented Aug 24, 2017

The reference documentation suggests to use EntityManagerFactoryBuilder to setup EntityManagerFactory instances in case one has to configure multiple ones. Unfortunately, the code shown doesn't work as the EMFB bean is created by JpaAutoConfiguration which expects a singular DataSource instance in the first place. Manually excluding that configuration then results in the EMFB not being present and the invocation of the factory method failing.

Maybe the auto-configuration for EMFB can be moved to a separate class that is not dependent on a single DataSource instance?

Related tickets: #5542, #5541.

@snicoll
Copy link
Member

snicoll commented Oct 3, 2017

It isn't that easy unfortunately. The EMFB requires a JpaVendorAdapter and the latter uses the DataSource to determine the database in use. A bunch of other properties are also related to the platform itself.

It is weird to provide such service as a bean and then make it work on a totally unrelated DataSource. The only reason it is a bean in the first place as far as I can see is to be able to tune it if necessary.

Back to the doc, it is incomplete as it doesn't tell you how to obtain that EntityManagerFactoryBuilder. Just adding an injection point suggests indeed that Spring Boot is going to provide one but I don't think that's a good idea.

My suggestion at this point would be to clarify the doc. Thoughts?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Oct 3, 2017
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Oct 10, 2017
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants