Interface MongoConfigurationContributor

All Superinterfaces:
Serializable, Service
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MongoConfigurationContributor extends Service
A Service an application may use for programmatically configuring the MongoDB Extension for Hibernate ORM.

This Service may be contributed either via a ServiceContributor, which allows access to StandardServiceRegistryBuilder, or via a StandardServiceRegistryBuilder directly, as shown below:


 MongoConfigurationContributor mongoConfigContributor = configurator -> {
     // configure the extension to your heart's content
     ...
 };
 var standardServiceRegistryBuilder = new StandardServiceRegistryBuilder()
         .addService(MongoConfigurationContributor.class, mongoConfigContributor);
 var metadataBuilder = new MetadataSources(standardServiceRegistryBuilder.build())
         .getMetadataBuilder();

 // add metadata (e.g. annotated Entity classes)
 ...

 try (var sessionFactory = metadataBuilder.build()
         .getSessionFactoryBuilder().build()) {
     // use the session factory
     ...
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Configures the MongoDB Extension for Hibernate ORM.