Re: JPA 2.2 API on Maven Central
toggle quoted messageShow quoted text
That's fine if you are describing one possible way the spec could be changed. However that is not how the spec is defined today. Today, your point (4) is actually defined as "pick one"; and in this "pick one case" it really is undefined which you will get when multiple are available. From section 9.2...
The Persistence bootstrap class must locate all of the persistence providers using the Persis-
tenceProviderResolver mechanism described in section 9.3 and call createEntityMan-
agerFactory on them in turn until an appropriate backing provider returns an
EntityManagerFactory instance. A provider may deem itself as appropriate for the persistence
unit if any of the following are true:
It then goes on to enumerate the ways in which a provider is allowed to "deem itself as appropriate for the persistence
In other words, if the PU did not (via <provider/> nor javax.persistence.provider setting) specify the provider to use, then any provider can act as the provider, and in your case (4) the first wins, as opposed to what you suggest which is to throw an exception. So today, from SE bootstrapping, as user who always wants to use Hibernate you *have to* either:
I hope we can all agree that (2) is a less-than-ideal. And as for (1), that's not always possible. But you are right in that this all boils down to how your (4) case is handled.
I wont get into the whole Maven + artifact manager discussion I had started to get into when I accidentally sent earlier, although I am happy to discuss that with anyone. Instead I'll just finish up that I think it is important to point out that while Bill describes the ideal case, this was clearly never the intent for JPA... otherwise why does the JPA TCK explicitly:
That's a rhetorical question - obviously it wouldn't. If the intent was to just always use this belssed jar, these tests would be pointless. Clearly this was the intended design from the get-go. For those of you without access to the TCK, I guess you'll have to take my word for it - making the TCK publicly available (ideally OSS) is a much more worthwhile change to discuss IMO ;)
Bottom line... while we can debate whether to change this, it is unfortunately a change. And we have already been told, in regards to other requests for changes, that it is too late for changes to make into this MR :(
On Thu, Aug 10, 2017 at 10:36 AM Steve Ebersole <steve@...> wrote: