Javax.validation.ConstraintViolationException, ConstraintViolationImpl{interpolatedMessage='may not be null', propertyPa
Posted: 07 Jan 2025, 13:04
Ich versuche, das Objekt der Klasse DocumentType mithilfe von Hibernate zu speichern.
Auf der Clientseite (mit Angular js) übergebe ich das Feld Workflow so (ich kann nur die ID des Workflow-Objekts übergeben):
Beim Speichern eines Objekts erhalte ich Folgendes:
Klasse DocumentType:
Klassen-Workflow:
Was mache ich falsch?
Auf der Clientseite (mit Angular js) übergebe ich das Feld Workflow so (ich kann nur die ID des Workflow-Objekts übergeben):
Code: Select all
Code: Select all
javax.validation.ConstraintViolationException, ConstraintViolationImpl{interpolatedMessage='may not be null', propertyPath=workflow
Code: Select all
@Entity
@Table(name = "${subsystem.table.prefix}_ref_document_type")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@JsonIgnoreProperties({"new", "workflow", "docClass", "parentTypes", "cacheNames"})
@AttributeOverride(
name = "rowId",
column = @Column(name = "uniqueid", insertable = false, updatable = false)
)
public class DocumentType extends AbstractPeriodCodeReference {
public static final String CACHE_NAME = "documentTypes";
@Override
public String[] getCacheNames() {
return new String[]{CACHE_NAME};
}
@Getter
@Setter
@NotBlank
@Column(nullable = false, length = 512)
private String name;
@Getter
@Setter
@NotBlank
@Column(nullable = false)
private String shortName;
@Getter
@Setter
@NotNull
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "subtype_id", nullable = false)
private DocumentSubtype subtype;
@Getter
@Setter
@NotNull
@Type(
type = HibernateIntegerEnumType.CLASS_NAME,
parameters = @Parameter(name = HibernateIntegerEnumType.PARAMETER_NAME, value = TypeDocumentEnum.ENUM_CLASS)
)
@Column(nullable = false, name = "in_out", columnDefinition = "number(1,0)")
private TypeDocumentEnum inout;
@Getter
@Setter
@NotNull
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "workflow_id", nullable = false)
private Workflow workflow;
@Getter
@Setter
@Column(nullable = false)
private boolean docflowable;
@Getter
@Column(nullable = false)
private boolean creatable;
@Getter
@ManyToOne(optional = true, cascade = CascadeType.ALL)
@JoinColumn(name = "docflow_code", nullable = true)
private DocflowType docflowType;
@Getter
@OneToMany(mappedBy = "type", fetch = FetchType.LAZY)
private Set parentTypes = Sets.newHashSet();
@Getter
@Formula("'(' || code || ') ' || name")
private String fullName;
@Getter
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "core_ref_doc_signer_type",
joinColumns = @JoinColumn(name = "doc_code"),
inverseJoinColumns = @JoinColumn(name = "type_id")
)
private Set signerTypes = Sets.newHashSet();
@Getter
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "core_ref_subsystem_doc_type",
joinColumns = @JoinColumn(name = "doc_code"),
inverseJoinColumns = @JoinColumn(name = "subsystem_id")
)
private Set subsystems = Sets.newHashSet();
public DocumentType(String code) {
Validate.notBlank(code);
this.setCode(code);
}
}
Code: Select all
@Entity
@Table(name = "core_workflow")
@Immutable
@Getter
public class Workflow extends AbstractSortableEntity {
@NotBlank
@Column(nullable = false)
private String name;
@NotEmpty
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "${subsystem.table.prefix}_initial_workflow_status",
joinColumns = @JoinColumn(name = "workflow_id", nullable = false),
inverseJoinColumns = @JoinColumn(name = "status_id", nullable = false)
)
private Set initialStatuses;
@OneToMany(mappedBy = "pk.workflow", fetch = FetchType.LAZY)
private Set transitions;
}