Skip to content
This repository was archived by the owner on Jan 30, 2019. It is now read-only.
This repository was archived by the owner on Jan 30, 2019. It is now read-only.

Enable Implicit Persistence Unit from Data Source? #41

@glassfishrobot

Description

@glassfishrobot

With platforms like Ruby and Play! the underlying persistence engine is often automatically enabled when a data source is defined for the application (in fact these platforms often assume only one data source per application). More recently Spring Boot appears to have understandably adopted this convention as well, ironically utilizing the JPA bootstrap API. We should explore if this is the correct default convention for Java EE.

Specifically this would mean detecting an application defined data source (e.g. via @DataSourceDefinition), detecting JPA usage in the application (e.g. via entity manager injection) and auto-wiring/enabling a sensible persistence unit that the application can use as opposed to having an explicit persistence.xml for the "default case".

This particular convention can be potentially incorrect so we should weigh it carefully with community and expert group input. The problem is that as far as I have seen personally, developers often need to put in persistence.xml settings/properties for very common cases such as logging, debugging, caching and schema generation. This is particularly true during development and testing. This may mean that this particular convention may be a potential source of confusion instead of being helpful. Nonetheless, it is at least worth considering carefully and gathering feedback.

Please note that these are purely my personal views that may or may not reflect consensus at Oracle as a company.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions