add a code example lifted from the Native Bootstrapping guide to jdoc
This commit is contained in:
parent
e9f826ee3c
commit
1a0be6e887
|
@ -6,20 +6,71 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This package contains the contracts that make up the bootstrap API
|
* This package contains the interfaces that make up the bootstrap API
|
||||||
* for Hibernate. That is, they collectively provide a way to specify
|
* for Hibernate. They collectively provide a way to specify configuration
|
||||||
* configuration information and construct a new instance of
|
* information and construct a new instance of {@link org.hibernate.SessionFactory}.
|
||||||
* {@link org.hibernate.SessionFactory}.
|
* <p>
|
||||||
|
* Configuring Hibernate using these APIs usually involves working with:
|
||||||
|
* <ol>
|
||||||
|
* <li>{@link org.hibernate.boot.registry.StandardServiceRegistryBuilder},
|
||||||
|
* then
|
||||||
|
* <li>{@link org.hibernate.boot.MetadataSources} and
|
||||||
|
* {@link org.hibernate.boot.MetadataBuilder}, and
|
||||||
|
* <li>finally, with {@link org.hibernate.boot.SessionFactoryBuilder}.
|
||||||
|
* </ol>
|
||||||
|
* <pre>
|
||||||
|
* StandardServiceRegistry standardRegistry =
|
||||||
|
* new StandardServiceRegistryBuilder()
|
||||||
|
* // supply a configuration
|
||||||
|
* .configure("org/hibernate/example/hibernate.cfg.xml")
|
||||||
|
* // set a configuration property
|
||||||
|
* .applySetting(AvailableSettings.HBM2DDL_AUTO,
|
||||||
|
* SchemaAutoTooling.CREATE_DROP.externalForm())
|
||||||
|
* .build();
|
||||||
|
* MetadataBuilder metadataBuilder =
|
||||||
|
* new MetadataSources(standardRegistry)
|
||||||
|
* // supply annotated classes
|
||||||
|
* .addAnnotatedClass(MyEntity.class)
|
||||||
|
* .addAnnotatedClassName("org.hibernate.example.Customer")
|
||||||
|
* // supply XML-based mappings
|
||||||
|
* .addResource("org/hibernate/example/Order.hbm.xml")
|
||||||
|
* .addResource("org/hibernate/example/Product.orm.xml")
|
||||||
|
* .getMetadataBuilder();
|
||||||
|
* Metadata metadata =
|
||||||
|
* metadataBuilder
|
||||||
|
* // set the naming strategies
|
||||||
|
* .applyImplicitNamingStrategy(ImplicitNamingStrategyJpaCompliantImpl.INSTANCE)
|
||||||
|
* .applyPhysicalNamingStrategy(new CustomPhysicalNamingStrategy())
|
||||||
|
* // add a TypeContributor
|
||||||
|
* .applyTypes(new CustomTypeContributor())
|
||||||
|
* .build();
|
||||||
|
* SessionFactoryBuilder sessionFactoryBuilder =
|
||||||
|
* metadata.getSessionFactoryBuilder();
|
||||||
|
* SessionFactory sessionFactory =
|
||||||
|
* sessionFactoryBuilder
|
||||||
|
* // supply a factory-level Interceptor
|
||||||
|
* .applyInterceptor(new CustomSessionFactoryInterceptor());
|
||||||
|
* // add a custom observer
|
||||||
|
* .addSessionFactoryObservers(new CustomSessionFactoryObserver());
|
||||||
|
* // apply a CDI BeanManager (for JPA event listeners)
|
||||||
|
* .applyBeanManager(getBeanManager());
|
||||||
|
* .build();
|
||||||
|
* </pre>
|
||||||
|
* <p>
|
||||||
|
* In more advanced scenarios,
|
||||||
|
* {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder}
|
||||||
|
* might also be used.
|
||||||
* <p>
|
* <p>
|
||||||
* Configuring Hibernate using these APIs usually starts with
|
|
||||||
* {@link org.hibernate.boot.MetadataBuilder} and
|
|
||||||
* {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder}.
|
|
||||||
* See the <em>Native Bootstrapping</em> guide for more details.
|
* See the <em>Native Bootstrapping</em> guide for more details.
|
||||||
* <p>
|
* <p>
|
||||||
* Included in subpackages under this namespace are:
|
* Included in subpackages under this namespace are:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
* <li>{@linkplain org.hibernate.boot.registry implementations} of
|
||||||
|
* {@link org.hibernate.service.ServiceRegistry} used during
|
||||||
|
* the bootstrap process,
|
||||||
* <li>implementations of {@link org.hibernate.boot.MetadataBuilder}
|
* <li>implementations of {@link org.hibernate.boot.MetadataBuilder}
|
||||||
* and {@link org.hibernate.boot.Metadata},
|
* and {@link org.hibernate.boot.Metadata}, and
|
||||||
|
* {@link org.hibernate.boot.SessionFactoryBuilder},
|
||||||
* <li>{@linkplain org.hibernate.boot.model.naming support} for
|
* <li>{@linkplain org.hibernate.boot.model.naming support} for
|
||||||
* {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy}
|
* {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy}
|
||||||
* and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy},
|
* and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy},
|
||||||
|
@ -27,16 +78,16 @@
|
||||||
* integration with the process of building metadata,
|
* integration with the process of building metadata,
|
||||||
* <li>internal code for parsing and interpreting mapping information
|
* <li>internal code for parsing and interpreting mapping information
|
||||||
* declared in XML or using annotations,
|
* declared in XML or using annotations,
|
||||||
* <li>{@linkplain org.hibernate.boot.registry implementations} of
|
|
||||||
* {@link org.hibernate.service.ServiceRegistry} used during
|
|
||||||
* the bootstrap process,
|
|
||||||
* <li>{@linkplain org.hibernate.boot.beanvalidation support} for
|
* <li>{@linkplain org.hibernate.boot.beanvalidation support} for
|
||||||
* integrating an implementation of Bean Validation, such as
|
* integrating an implementation of Bean Validation, such as
|
||||||
* Hibernate Validator, and
|
* <a href="https://hibernate.org/validator/">Hibernate Validator</a>,
|
||||||
|
* and
|
||||||
* <li>{@linkplain org.hibernate.boot.model.relational some SPIs}
|
* <li>{@linkplain org.hibernate.boot.model.relational some SPIs}
|
||||||
* used for schema management including support for exporting
|
* used for schema management, including support for exporting
|
||||||
* {@linkplain org.hibernate.boot.model.relational.AuxiliaryDatabaseObject
|
* {@linkplain org.hibernate.boot.model.relational.AuxiliaryDatabaseObject
|
||||||
* auxiliary database objects}.
|
* auxiliary database objects}, and for determining the
|
||||||
|
* {@linkplain org.hibernate.boot.model.relational.ColumnOrderingStrategy
|
||||||
|
* order of columns} in generated DDL statements.
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot;
|
package org.hibernate.boot;
|
||||||
|
|
|
@ -6,16 +6,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines service registry contracts application are may utilize for configuring Hibernate.
|
* Defines {@linkplain org.hibernate.service.ServiceRegistry service registry} contracts a program may use for
|
||||||
|
* configuring Hibernate.
|
||||||
* <p>
|
* <p>
|
||||||
* Service registries are hierarchical. That is, a child registry may "hide" or "override" services from its parent
|
* Service registries are hierarchical. That is, a child registry may "hide" or "override" services from its parent
|
||||||
* registries. This allows for granular construction of registries as services become available.
|
* registries. This allows for granular construction of registries as services become available.
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>
|
* <li>
|
||||||
|
* <p>
|
||||||
* {@link org.hibernate.boot.registry.BootstrapServiceRegistry} is the base service registry, and may be constructed via
|
* {@link org.hibernate.boot.registry.BootstrapServiceRegistry} is the base service registry, and may be constructed via
|
||||||
* {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder} if customization is needed. For non-customized
|
* {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder} if customization is needed. For non-customized
|
||||||
* usage, these APIs may be bypassed completely.
|
* usage, these APIs may be bypassed completely.
|
||||||
* <li>
|
* <li>
|
||||||
|
* <p>
|
||||||
* The next level in a standard registry setup is the {@link org.hibernate.boot.registry.StandardServiceRegistry},
|
* The next level in a standard registry setup is the {@link org.hibernate.boot.registry.StandardServiceRegistry},
|
||||||
* which may be constructed using {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder} if customization
|
* which may be constructed using {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder} if customization
|
||||||
* is needed. The builder optionally accepts s {@link org.hibernate.boot.registry.BootstrapServiceRegistry} to use as a
|
* is needed. The builder optionally accepts s {@link org.hibernate.boot.registry.BootstrapServiceRegistry} to use as a
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.service.spi;
|
package org.hibernate.event.service.spi;
|
||||||
|
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
|
||||||
import org.hibernate.event.spi.EventType;
|
import org.hibernate.event.spi.EventType;
|
||||||
import org.hibernate.service.Service;
|
import org.hibernate.service.Service;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue