Hi everyone,
i have 3 entities: USER, GROUP and PRIVILEGES made like this:
public class Users {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "IDUtente", nullable = false, precision = 18)
@Id
private BigDecimal id;
@Column(name = "GroupLevels")
private Long groupLevels;
@JoinColumn(name = "IDGruppo", nullable = false)
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Groups iDGruppo;
@Column(name = "IDItem")
private Long idItem;
@Column(name = "IDTAb")
private Long idTab;
@JmixGeneratedValue
@Column(name = "ISrowguid", nullable = false)
private UUID iSrowguid;
@Column(name = "Parameters", length = 50)
private String parameters;
@Size(message = "{msg://com.company.configuratoreutenti.entity/Users.password.validation.Size}", min = 8)
@NotNull
@SystemLevel
@Secret
@Column(name = "Password", nullable = false, length = 50)
protected String password;
@InstanceName
@NotNull
@Column(name = "Username", nullable = false, unique = true, length = 50)
protected String username;
@JoinColumn(name = "SysLevel", nullable = false)
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Privilegi privilegi;
#########################
public class Groups {
//@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "IDGruppo", nullable = false)
@Id
private Integer idGruppo;
@InstanceName
@Column(name = "DESCRIZIONE")
private String descrizione;
@JmixGeneratedValue
@Column(name = "ISrowguid", unique = true)
private UUID isRowguid;
@OneToMany(mappedBy = "iDGruppo")
private List<Users> users;
@OneToMany(mappedBy = "iDGruppo", cascade = CascadeType.ALL)
private List<GestRisorse> gestRisorses;
public List<GestRisorse> getGestRisorses() {
return gestRisorses;
}
#############################
public class Privilegi {
//@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "SysLevel", nullable = false)
@Id
private Integer sysLevel;
@JmixGeneratedValue
@Column(name = "ISrowguid", unique = true, nullable = false)
private UUID iSrowguid;
@Column(name = "permessi", length = 20)
private String permessi;
@NotNull
@InstanceName
@Column(name = "Privilegio_Utente", length = 100)
private String privilegioUtente;
@OneToMany(mappedBy = "privilegi")
private List<Users> users;
When I create a new user and assign it the group with id 0 I get this exception:
this exception only appears when i link user with group id 0, if i were to link any other group i can make user creation correctly
Thanks in advance