Re: JPA 2.2 API on Maven Central

Steve Ebersole
 

>> I naively thought an implementation would be found via java.util.ServiceLoader. As long as one provider is in the class path it would be found etc.
>>
>> I would love to see an example of this (to perhaps understand why ServiceLoader does not work in this case?).  Do you have a link to example source for this Steve?

Did I say that ServiceLoader would not work? ;)  So I can't really give you an example of a case where it won't.  That said, ServiceLoader is not about picking one service or the other; its about finding available ones.  And in fact providers are required to be located via ServiceLoader (must include a META-INF/services/javax.persistence.spi.PersistenceProvider file).
That's not the problem.  The problem is working out which to use.  

As for "JavaSE bootstrapping":
1. if the user has defined <provider> then there is no issue ... use that (as long as it is found).
2. if the user hasn't defined <provider> and there is 1 JPA provider in the CLASSPATH then use that.
3. if the user hasn't defined <provider> and there is 0 JPA provider in the CLASSPATH then throw exception.
4. if the user hasn't defined <provider> and there is more than 1 JPA provider in the CLASSPATH then throw exception inviting them to "specify which one, we have these available".

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.

And we also need to look at the limitations of artifact managers.  I've lobbied Maven for a 

Join jpa-spec@javaee.groups.io to automatically receive all group messages.