根据内容:https://www.ossez.com/t/spring-lombok/14129 修改实体类死循环问题

This commit is contained in:
YuCheng Hu 2022-10-02 19:24:37 -04:00
parent efbefa7902
commit 82161ce5b4
2 changed files with 9 additions and 5 deletions

View File

@ -17,22 +17,23 @@ import java.util.Set;
* @author YuCheng Hu * @author YuCheng Hu
*/ */
@Entity
@Getter @Getter
@Setter @Setter
@Entity
@Accessors(chain = true) @Accessors(chain = true)
//@Table(name = "person", uniqueConstraints = {@UniqueConstraint(columnNames = "user_name"), @UniqueConstraint(columnNames = "user_email")}) //@Table(name = "person", uniqueConstraints = {@UniqueConstraint(columnNames = "user_name"), @UniqueConstraint(columnNames = "user_email")})
public class Person extends AbstractPersistable<Long> { public class Person extends AbstractPersistable<Long> {
@NotBlank @NotBlank
@Size(max = 20) @Size(max = 20)
private String userName; private String userName;
@NotBlank @NotBlank
@Size(max = 120) @Size(max = 120)
private String userPassword; private String userPassword;
@NotBlank @NotBlank
@Email @Email
private String userEmail; private String userEmail;

View File

@ -2,12 +2,15 @@ package com.ossez.spring.security.models.entity;
import com.ossez.spring.security.models.ERole; import com.ossez.spring.security.models.ERole;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.jpa.domain.AbstractPersistable; import org.springframework.data.jpa.domain.AbstractPersistable;
import javax.persistence.*; import javax.persistence.*;
@Entity @Entity
@Data @Getter
@Setter
public class PersonRole extends AbstractPersistable<Long> { public class PersonRole extends AbstractPersistable<Long> {
@ManyToOne(fetch = FetchType.LAZY, optional = false) @ManyToOne(fetch = FetchType.LAZY, optional = false)