define default values for @LazyCollection + @LazyToOne

this is low-hanging fruit
This commit is contained in:
Gavin King 2022-09-30 12:40:04 +02:00
parent a9c7c6d677
commit 4f4fd736dc
2 changed files with 15 additions and 6 deletions

View File

@ -12,7 +12,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Define the lazy status of a collection.
* Specify the laziness of a collection, either a
* {@link jakarta.persistence.OneToMany} or
* {@link jakarta.persistence.ManyToMany} association,
* or an {@link jakarta.persistence.ElementCollection}.
* <p>
* This is an alternative to specifying the JPA
* {@link jakarta.persistence.FetchType}.
*
* @author Emmanuel Bernard
*/
@ -20,7 +26,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface LazyCollection {
/**
* The laziness option for the collection.
* The laziness of the collection.
*/
LazyCollectionOption value();
LazyCollectionOption value() default LazyCollectionOption.TRUE;
}

View File

@ -12,8 +12,11 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Define the laziness options available for a {@link jakarta.persistence.OneToOne}
* Specify the laziness of a {@link jakarta.persistence.OneToOne}
* or {@link jakarta.persistence.ManyToOne}) association.
* <p>
* This is an alternative to specifying the JPA
* {@link jakarta.persistence.FetchType}.
*
* @author Emmanuel Bernard
*/
@ -21,7 +24,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface LazyToOne {
/**
* Specify the laziness option.
* The laziness of the association.
*/
LazyToOneOption value();
LazyToOneOption value() default LazyToOneOption.PROXY;
}