Linking a Repository to a Provider

When only one Jakarta Data provider handles the entity type, the repository does not need to specify which Jakarta Data provider to use.

However, when multiple Jakarta Data providers coexist in a system and handle the same entity type, the repository must specify a provider name to disambiguate which Jakarta Data provider to use.

The built-in Jakarta Data provider for Open Liberty uses the provider name, Liberty. The data-1.0 feature includes it.

Alternatively, You can use third-party Jakarta Data providers in Open Liberty by including the dataContainer-1.0 feature which only provides the Jakarta Data API (without the built-in Jakarta Data Provider).

Hibernate ORM Provider name example

@Repository(provider = "Hibernate", dataStore = "MyPersistenceUnit")
public interface Employee extends CrudRepository<Employee, Long> {
}

Eclipse JNoSQL Provider name example

@Repository(provider = "Eclipse_JNoSQL")
public interface Cars extends BasicRepository<Car, String> {
}

Built-in Provider name example

@Repository(provider = "Liberty", dataStore = "java:app/env/jdbc/MyDataSourceRef")
public interface Products extends CrudRepository<Product, String> {
}