javadoc about properties in Configuration

This commit is contained in:
Gavin King 2024-12-16 09:15:22 +01:00
parent af679e1d96
commit edb3c335b2
2 changed files with 19 additions and 6 deletions

View File

@ -81,6 +81,19 @@ import jakarta.persistence.SharedCacheMode;
* format, or in Hibernate's legacy {@code .hbm.xml} format.
* <p>
* Configuration properties are enumerated by {@link AvailableSettings}.
* <p>
* When instantiated, an instance of {@code Configuration} has its properties
* initially populated from the {@linkplain Environment#getProperties()
* environment}, including:
* <ul>
* <li>JVM {@linkplain System#getProperties() system properties}, and
* <li>properties specified in {@code hibernate.properties}.
* </ul>
* <p>
* These initial properties may be completely discarded by calling
* {@link #setProperties(Properties)}, or they may be overridden
* individually by calling {@link #setProperty(String, String)}.
* <p>
* <pre>
* SessionFactory factory = new Configuration()
* // scan classes for mapping annotations

View File

@ -163,7 +163,7 @@ public final class Environment implements AvailableSettings {
}
try {
Properties systemProperties = System.getProperties();
final Properties systemProperties = System.getProperties();
// Must be thread-safe in case an application changes System properties during Hibernate initialization.
// See HHH-8383.
synchronized (systemProperties) {
@ -183,11 +183,11 @@ public final class Environment implements AvailableSettings {
}
/**
* The {@link System#getProperties() system properties}, extended with all
* additional properties specified in {@code hibernate.properties}.
* The {@linkplain System#getProperties() system properties}, extended
* with all additional properties specified in {@code hibernate.properties}.
*/
public static Properties getProperties() {
Properties copy = new Properties();
final Properties copy = new Properties();
copy.putAll(GLOBAL_PROPERTIES);
return copy;
}