Skip to content

Commit 3fb6c1c

Browse files
committed
Refresh the javadoc of a bunch of annotations
1 parent 596debe commit 3fb6c1c

File tree

6 files changed

+45
-31
lines changed

6 files changed

+45
-31
lines changed

hibernate-core/src/main/java/org/hibernate/FetchMode.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
package org.hibernate;
88

99
/**
10-
* Represents an association fetching strategy. This is used
11-
* together with the {@code Criteria} API to specify runtime
12-
* fetching strategies.
13-
* <p>
14-
* For HQL queries, use the {@code FETCH} keyword instead.
15-
*
16-
* @see Criteria#setFetchMode(String, FetchMode)
10+
* Represents an association fetching strategy.
1711
*
1812
* @author Gavin King
1913
*/

hibernate-core/src/main/java/org/hibernate/annotations/Fetch.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
import java.lang.annotation.Target;
1313

1414
/**
15-
* Define the fetching strategy used for the given association.
15+
* Specify the fetching strategy used for the annotated association.
1616
*
1717
* @author Emmanuel Bernard
18+
*
19+
* @see FetchMode
1820
*/
1921
@Target({ElementType.METHOD, ElementType.FIELD})
2022
@Retention(RetentionPolicy.RUNTIME)
2123
public @interface Fetch {
2224
/**
23-
* The style of fetch to use.
25+
* The method that should be used to fetch the association.
2426
*/
2527
FetchMode value();
2628
}

hibernate-core/src/main/java/org/hibernate/annotations/FetchMode.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,27 @@
77
package org.hibernate.annotations;
88

99
/**
10-
* Fetch options on associations. Defines more of the "how" of fetching, whereas JPA {@link jakarta.persistence.FetchType}
11-
* focuses on the "when".
10+
* Enumerates the association fetching strategies available in Hibernate.
11+
* <p>
12+
* Whereas the JPA {@link jakarta.persistence.FetchType} enumeration provides a way to
13+
* specify <em>when</em> an association should be fetched, this enumeration provides a
14+
* way to express <em>how</em> it should be fetched.
1215
*
1316
* @author Emmanuel Bernard
1417
*/
1518
public enum FetchMode {
1619
/**
17-
* Use a secondary select for each individual entity, collection, or join load.
20+
* The association or collection is fetched with a separate subsequent SQL select.
1821
*/
1922
SELECT,
2023
/**
21-
* Use an outer join to load the related entities, collections or joins.
24+
* The association or collection is fetched using an outer join clause added to
25+
* the initial SQL select.
2226
*/
2327
JOIN,
2428
/**
25-
* Available for collections only.  When accessing a non-initialized collection, this fetch mode will trigger loading all elements of all collections of the same role for all owners associated with the persistence context using a single secondary select.
29+
* For collections and many-valued associations only. After the initial SQL select,
30+
* all associated collections are fetched together in a single subsequent select.
2631
*/
2732
SUBSELECT
2833
}

hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@
77
package org.hibernate.annotations;
88

99
/**
10-
* Enumeration extending jakarta.persistence flush modes.
10+
* Enumeration extending {@link jakarta.persistence.FlushModeType JPA flush modes} with
11+
* flush modes specific to Hibernate, and a "null" flush mode, {@link #PERSISTENCE_CONTEXT}
12+
* for use as a default annotation value. Except for the null value, this enumeration is
13+
* isomorphic to {@link org.hibernate.FlushMode}.
1114
*
1215
* @author Carlos Gonzalez-Cadenas
16+
*
17+
* @see NamedQuery
18+
* @see NamedNativeQuery
1319
*/
1420
public enum FlushModeType {
1521
/**

hibernate-core/src/main/java/org/hibernate/annotations/Immutable.java

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,35 @@
55
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
66
*/
77
package org.hibernate.annotations;
8-
import java.lang.annotation.ElementType;
8+
9+
import java.lang.annotation.Target;
910
import java.lang.annotation.Retention;
1011
import java.lang.annotation.RetentionPolicy;
1112

13+
import static java.lang.annotation.ElementType.*;
14+
1215
/**
13-
* Mark an Entity, a Collection, or an Attribute type as immutable. No annotation means the element is mutable.
14-
* <p>
15-
* An immutable entity may not be updated by the application. Updates to an immutable
16-
* entity will be ignored, but no exception is thrown. &#064;Immutable must be used on root entities only.
17-
* </p>
18-
* <p>
19-
* &#064;Immutable placed on a collection makes the collection immutable, meaning additions and
20-
* deletions to and from the collection are not allowed. A <i>HibernateException</i> is thrown in this case.
21-
* </p>
22-
* <p>
23-
* An immutable attribute type will not be copied in the currently running Persistence Context in order to detect if the underlying value is dirty. As a result loading the entity will require less memory
24-
* and checking changes will be much faster.
25-
* </p>
16+
* Marks an entity, collection, or attribute as immutable. The absence of this annotation
17+
* means the element is mutable.
18+
* <ul>
19+
* <li>
20+
* Changes made in memory to the state of an immutable entity are never synchronized to
21+
* the database. The changes are ignored, with no exception thrown. In a mapped inheritance
22+
* hierarchy, {@code @Immutable} may be applied only to the root entity.
23+
* </li>
24+
* <li>
25+
* An immutable collection may not be modified. A {@link org.hibernate.HibernateException}
26+
* is thrown if an element is added to or removed from the collection.
27+
* </li>
28+
* <li>
29+
* An immutable attribute is ignored by the dirty-checking process, and so the persistence
30+
* context does not need to keep track of its state. This may help reduce memory allocation.
31+
* </li>
32+
* </ul>
2633
*
2734
* @author Emmanuel Bernard
2835
*/
29-
@java.lang.annotation.Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
36+
@Target({TYPE, METHOD, FIELD})
3037
@Retention( RetentionPolicy.RUNTIME )
3138
public @interface Immutable {
3239
}

hibernate-core/src/main/java/org/hibernate/annotations/NamedQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* @see org.hibernate.query.Query
2323
*/
24-
@Target( { TYPE, PACKAGE })
24+
@Target({TYPE, PACKAGE})
2525
@Retention(RUNTIME)
2626
@Repeatable(NamedQueries.class)
2727
public @interface NamedQuery {

0 commit comments

Comments
 (0)