注释接口 ManyToOne
@Documented
@Retention(RUNTIME)
@Target(allowedTargets=PROPERTY)
@Target(METHOD)
public @interface ManyToOne
This annotation decorate many-to-one association.
When any of the following occurs, the associated property must be nullable:
- The foreign key in the database is null
- The foreign key is fake, that means it is not a real foreign key constraint in the database, but rather a convention that exists only in the developer's subjective consciousness. (In this case, it is necessary to use @JoinColumn(name = "...", foreignKey = false))
- The current association is based on middle table, not on foreign key
- The current association is a remote association, that means the microservice names of the declaring entity and target entity are different
- There are some global filters whose generic type is the target entity type, even if all the global filters
-
可选元素概要
可选元素修饰符和类型可选元素说明booleanSometimes, the foreign key in the database is not null, but the developer has to declare the many-to-one property as a nullable property in the entity type.
-
元素详细资料
-
inputNotNull
boolean inputNotNullSometimes, the foreign key in the database is not null, but the developer has to declare the many-to-one property as a nullable property in the entity type. Global filter is a typical scenario. Although the non-null foreign key in the database indicates that the parent object exists absolutely, once the filtering behavior is applied to the class to which the parent object belongs, it is still possible that no parent object data can be found. At this time, in order to cope with the query business, we hope to set a many-to-one association as nullable, but we still hope that the user must specify a non-null parent object in save business. At this time, you can specify the `inputNotNull` of this annotation.- 默认值:
false
-