Run Hibernate OGM without its provider persistence property

Description

Make no longer mandatory setting the persistence property `provider` to `org.hibernate.ogm.jpa.Hibernate Persistence` in order to run Hibernate OGM.

We decided to enable OGM implicitly when a JDBC connection URL, a datasource and a dialect are not provided. The user can still decide not to enable OGM by setting the `hibernate.ogm.enabled property` to false.

Environment

None

Activity

Show:
Sanne Grinovero
August 10, 2018, 11:39 AM
Edited

I recently found this method, which might be useful for this:

javax.persistence.spi.PersistenceProviderResolverHolder#setPersistenceProviderResolver

At least we could make sure to try the OGM provider before the ORM one.

Fabio Massimo Ercoli
August 10, 2018, 12:54 PM

Sounds good! Thank you

Fabio Massimo Ercoli
August 13, 2018, 1:50 PM
Edited

The current base Hibernate ORM persistence provider is actually able to run a Hibernate OGM SessionFactory, such as the OGM one. The problem was relative to OgmServiceRegistryInitializer, that is the class responsible for providing the extra OGM services. Before this issue the services were provided if and only if the property `hibernate.ogm.enabled` was set to true. This property can be set by the user or the OGM provider. After the issue, the services are provided also if an `OGM implicit activation` is detected, such as if neither a jdbc connection URL nor a datasource nor a dialect is provided.

Fixed

Assignee

Fabio Massimo Ercoli

Reporter

Fabio Massimo Ercoli

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

Priority

Major
Configure