Skip to content

Commit edb3c33

Browse files
committed
javadoc about properties in Configuration
1 parent af679e1 commit edb3c33

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,28 @@
7474
* <li>{@linkplain #setProperty(String, String) configuration properties}
7575
* from various sources, and
7676
* <li>entity O/R mappings, defined in either {@linkplain #addAnnotatedClass
77-
* annotated classes}, or {@linkplain #addFile XML mapping documents}.
77+
* annotated classes}, or {@linkplain #addFile XML mapping documents}.
7878
* </ul>
7979
* <p>
8080
* Note that XML mappings may be expressed using the JPA {@code orm.xml}
8181
* format, or in Hibernate's legacy {@code .hbm.xml} format.
8282
* <p>
8383
* Configuration properties are enumerated by {@link AvailableSettings}.
84+
* <p>
85+
* When instantiated, an instance of {@code Configuration} has its properties
86+
* initially populated from the {@linkplain Environment#getProperties()
87+
* environment}, including:
88+
* <ul>
89+
* <li>JVM {@linkplain System#getProperties() system properties}, and
90+
* <li>properties specified in {@code hibernate.properties}.
91+
* </ul>
92+
* <p>
93+
* These initial properties may be completely discarded by calling
94+
* {@link #setProperties(Properties)}, or they may be overridden
95+
* individually by calling {@link #setProperty(String, String)}.
96+
* <p>
8497
* <pre>
85-
* SessionFactory factory = new Configuration()
98+
* SessionFactory factory = new Configuration()
8699
* // scan classes for mapping annotations
87100
* .addAnnotatedClass(Item.class)
88101
* .addAnnotatedClass(Bid.class)

hibernate-core/src/main/java/org/hibernate/cfg/Environment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public final class Environment implements AvailableSettings {
163163
}
164164

165165
try {
166-
Properties systemProperties = System.getProperties();
166+
final Properties systemProperties = System.getProperties();
167167
// Must be thread-safe in case an application changes System properties during Hibernate initialization.
168168
// See HHH-8383.
169169
synchronized (systemProperties) {
@@ -183,11 +183,11 @@ private Environment() {
183183
}
184184

185185
/**
186-
* The {@link System#getProperties() system properties}, extended with all
187-
* additional properties specified in {@code hibernate.properties}.
186+
* The {@linkplain System#getProperties() system properties}, extended
187+
* with all additional properties specified in {@code hibernate.properties}.
188188
*/
189189
public static Properties getProperties() {
190-
Properties copy = new Properties();
190+
final Properties copy = new Properties();
191191
copy.putAll(GLOBAL_PROPERTIES);
192192
return copy;
193193
}

0 commit comments

Comments
 (0)