Add user reference field in SysUserNode
Introduced a `user` field with `AggregateReference` to link SysUserNode to SysUser. This ensures better relational mapping and enforces non-null constraints with `@NotNull` and proper column mapping.
This commit is contained in:
parent
71639aac57
commit
332fd96eee
1 changed files with 6 additions and 0 deletions
|
|
@ -3,6 +3,8 @@ package de.avatic.lcc.model.user;
|
||||||
|
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||||
|
import org.springframework.data.relational.core.mapping.Column;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -13,6 +15,10 @@ public class SysUserNode {
|
||||||
@Id
|
@Id
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column("user_id")
|
||||||
|
private AggregateReference<SysUser, Integer> user;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Size(max = 254)
|
@Size(max = 254)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue