deprecate @Target which dupes functionality of JPA annotations

...and refresh some misc annotation javadoc
This commit is contained in:
Gavin 2022-11-27 21:26:28 +01:00 committed by Gavin King
parent dd36425b31
commit 922e71d626
11 changed files with 41 additions and 22 deletions

View File

@ -11,7 +11,7 @@ import jakarta.persistence.CacheRetrieveMode;
import jakarta.persistence.CacheStoreMode; import jakarta.persistence.CacheStoreMode;
/** /**
* Controls how the session interacts with the {@link Cache second-level cache} * Controls how the session interacts with the {@linkplain Cache second-level cache}
* or {@linkplain org.hibernate.query.SelectionQuery#isCacheable() query cache}. * or {@linkplain org.hibernate.query.SelectionQuery#isCacheable() query cache}.
* An instance of {@code CacheMode} may be viewed as packaging a JPA-defined * An instance of {@code CacheMode} may be viewed as packaging a JPA-defined
* {@link CacheStoreMode} with a {@link CacheRetrieveMode}. For example, * {@link CacheStoreMode} with a {@link CacheRetrieveMode}. For example,

View File

@ -16,10 +16,11 @@ import java.lang.annotation.Target;
import org.hibernate.tuple.CreationTimestampGeneration; import org.hibernate.tuple.CreationTimestampGeneration;
/** /**
* Marks a property as the creation timestamp of the containing entity. The property value will be set to the current * Marks a property as the creation timestamp of the containing entity.
* VM date exactly once when saving the owning entity for the first time. * The property value is set to the current VM datetime when the owning
* entity is made persistent for the first time.
* <p> * <p>
* Supported property types: * The annotated field or property must be of one of the following types:
* <ul> * <ul>
* <li>{@link java.util.Date}</li> * <li>{@link java.util.Date}</li>
* <li>{@link java.util.Calendar}</li> * <li>{@link java.util.Calendar}</li>

View File

@ -7,8 +7,8 @@
package org.hibernate.annotations; package org.hibernate.annotations;
/** /**
* Enumeration extending {@link jakarta.persistence.FlushModeType JPA flush modes} with * Enumeration extending the {@linkplain jakarta.persistence.FlushModeType JPA flush modes}
* flush modes specific to Hibernate, and a "null" flush mode, {@link #PERSISTENCE_CONTEXT} * with flush modes specific to Hibernate, and a "null" mode, {@link #PERSISTENCE_CONTEXT},
* for use as a default annotation value. Except for the null value, this enumeration is * for use as a default annotation value. Except for the null value, this enumeration is
* isomorphic to {@link org.hibernate.FlushMode}. * isomorphic to {@link org.hibernate.FlushMode}.
* *

View File

@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* *
* @author Emmanuel Bernard * @author Emmanuel Bernard
* *
* @deprecated Using {@link jakarta.persistence.Index} instead. * @deprecated Use {@link jakarta.persistence.Index} instead.
*/ */
@Target({FIELD, METHOD}) @Target({FIELD, METHOD})
@Retention(RUNTIME) @Retention(RUNTIME)

View File

@ -20,7 +20,7 @@ import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Used to specify a {@link MutabilityPlan} for a basic value mapping. * Specifies a {@link MutabilityPlan} for a basic value mapping.
* <ul> * <ul>
* <li> * <li>
* When applied to a Map-valued attribute, describes the * When applied to a Map-valued attribute, describes the

View File

@ -13,7 +13,8 @@ import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Lazy and proxy configuration of a particular class. * Allows the proxy class of an entity class to be explicitly specified.
* This annotation is almost never useful.
* *
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@ -21,12 +22,12 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface Proxy { public @interface Proxy {
/** /**
* Whether this class is lazy or not. Default to true. * Whether this class may be proxied. Default to true.
*/ */
boolean lazy() default true; boolean lazy() default true;
/** /**
* Proxy class or interface used. Default is to use the entity class name. * Proxy class or interface used. Default is to the annotated entity class itself.
*/ */
Class<?> proxyClass() default void.class; Class<?> proxyClass() default void.class;
} }

View File

@ -14,6 +14,11 @@ package org.hibernate.annotations;
* the expected number of rows. * the expected number of rows.
* *
* @author L<EFBFBD>szl<EFBFBD> Benke * @author L<EFBFBD>szl<EFBFBD> Benke
*
* @see SQLInsert#check()
* @see SQLUpdate#check()
* @see SQLDelete#check()
* @see SQLDeleteAll#check()
*/ */
public enum ResultCheckStyle { public enum ResultCheckStyle {
/** /**

View File

@ -13,10 +13,12 @@ import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Ensures that auto-flush happens correctly and that queries against the derived * Specifies the tables that hold state mapped by the annotated derived
* entity do not return stale data. * entity, ensuring that auto-flush happens correctly and that queries
* * against the derived entity do not return stale data.
* Mostly used with {@link Subselect}. * <p>
* This annotation may be used in combination with {@link Subselect}, or
* when an entity maps a database view.
* *
* @author Sharath Reddy * @author Sharath Reddy
*/ */
@ -24,7 +26,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface Synchronize { public @interface Synchronize {
/** /**
* Table names. * Names of tables that hold state mapped by the derived entity.
* Updates to these tables must be flushed to the database before
* the derived entity is queried.
*/ */
String[] value(); String[] value();
} }

View File

@ -11,10 +11,17 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/** /**
* Define an explicit target, avoiding reflection and generics resolving. * Explicitly specifies the target entity type in an association,
* avoiding reflection and generics resolution. This annotation is
* almost never useful.
* *
* @author Emmanuel Bernard * @author Emmanuel Bernard
*
* @deprecated use annotation members of JPA association mapping
* annotations, for example,
* {@link jakarta.persistence.OneToMany#targetEntity()}
*/ */
@Deprecated
@java.lang.annotation.Target({ElementType.FIELD, ElementType.METHOD}) @java.lang.annotation.Target({ElementType.FIELD, ElementType.METHOD})
@Retention( RetentionPolicy.RUNTIME ) @Retention( RetentionPolicy.RUNTIME )
public @interface Target { public @interface Target {

View File

@ -16,10 +16,11 @@ import java.lang.annotation.Target;
import org.hibernate.tuple.UpdateTimestampGeneration; import org.hibernate.tuple.UpdateTimestampGeneration;
/** /**
* Marks a property as the update timestamp of the containing entity. The property value will be set to the current VM * Marks a property as the update timestamp of the containing entity.
* date whenever the owning entity is updated. * The property value will be set to the current VM datetime whenever
* the owning entity is updated.
* <p> * <p>
* Supported property types: * The annotated field or property must be of one of the following types:
* <ul> * <ul>
* <li>{@link java.util.Date}</li> * <li>{@link java.util.Date}</li>
* <li>{@link java.util.Calendar}</li> * <li>{@link java.util.Calendar}</li>

View File

@ -6,7 +6,7 @@
*/ */
/** /**
* Package containing all Hibernate's specific annotations. * A set of mapping annotations which extend the O/R mapping annotations defined by JPA.
* *
* <h3 id="basic-value-mapping">Basic value mapping</h3> * <h3 id="basic-value-mapping">Basic value mapping</h3>
* *
@ -41,6 +41,6 @@
* the compositional approach. Though the compositional approach is recommended, both forms are * the compositional approach. Though the compositional approach is recommended, both forms are
* fully supported. * fully supported.
* *
* See the user-guide for a more in-depth discussion * Please see the user guide for a more in-depth discussion.
*/ */
package org.hibernate.annotations; package org.hibernate.annotations;