add code example to javadoc

This commit is contained in:
Gavin 2022-12-21 17:51:23 +01:00
parent a9f34f0735
commit d0a510896e
2 changed files with 18 additions and 11 deletions

View File

@ -62,14 +62,10 @@ import jakarta.persistence.AttributeConverter;
import jakarta.persistence.SharedCacheMode; import jakarta.persistence.SharedCacheMode;
/** /**
* A convenience API making it easier to bootstrap an instance of Hibernate * A convenience API making it easier to bootstrap an instance of Hibernate.
* using {@link MetadataBuilder} and {@link StandardServiceRegistryBuilder}
* under the covers.
* <p> * <p>
* An instance of {@code Configuration} may be obtained simply by * An instance of {@code Configuration} may be obtained simply by
* {@linkplain #Configuration() instantiation}. * {@linkplain #Configuration() instantiation}, and may be used to aggregate:
* <p>
* A {@code Configuration} may be used to aggregate:
* <ul> * <ul>
* <li>{@linkplain #setProperty(String, String) configuration properties} * <li>{@linkplain #setProperty(String, String) configuration properties}
* from various sources, and * from various sources, and
@ -79,6 +75,20 @@ import jakarta.persistence.SharedCacheMode;
* Note that XML mappings may be expressed using the JPA {@code orm.xml} * Note that XML mappings may be expressed using the JPA {@code orm.xml}
* format, or in Hibernate's legacy {@code .hbm.xml} format. * format, or in Hibernate's legacy {@code .hbm.xml} format.
* <p> * <p>
* Configuration properties are enumerated by {@link AvailableSettings}.
* <pre>{@code
* SessionFactory factory = new Configuration()
* // scan classes for mapping annotations
* .addAnnotatedClass(Item.class)
* .addAnnotatedClass(Bid.class)
* .addAnnotatedClass(User.class)
* // read package-level annotations of the named package
* .addPackage("org.hibernate.auction")
* // set a configuration property
* .setProperty(AvailableSettings.DATASOURCE,
* "java:comp/env/jdbc/test")
* .getSessionFactory();
* }</pre>
* In addition, there are convenience methods for adding * In addition, there are convenience methods for adding
* {@link #addAttributeConverter attribute converters}, * {@link #addAttributeConverter attribute converters},
* {@link #registerTypeContributor type contributors}, * {@link #registerTypeContributor type contributors},
@ -95,8 +105,8 @@ import jakarta.persistence.SharedCacheMode;
* Ultimately, this class simply delegates to {@link MetadataBuilder} and * Ultimately, this class simply delegates to {@link MetadataBuilder} and
* {@link StandardServiceRegistryBuilder} to actually do the hard work of * {@link StandardServiceRegistryBuilder} to actually do the hard work of
* {@linkplain #buildSessionFactory() building} the {@code SessionFactory}. * {@linkplain #buildSessionFactory() building} the {@code SessionFactory}.
* <p> * Programs may use these APIs directly as an alternative to using an
* Configuration properties are enumerated by {@link AvailableSettings}. * instance of this class.
* *
* @author Gavin King * @author Gavin King
* @author Steve Ebersole * @author Steve Ebersole

View File

@ -13,9 +13,6 @@ package org.hibernate.cfg;
* document. May be used to implement project-scoped * document. May be used to implement project-scoped
* naming standards for database objects. * naming standards for database objects.
* *
* #propertyToTableName(String, String) should be replaced by
* {@link #collectionTableName(String,String,String,String,String)}
*
* @see DefaultNamingStrategy * @see DefaultNamingStrategy
* @see ImprovedNamingStrategy * @see ImprovedNamingStrategy
* @author Gavin King * @author Gavin King