Javax.validation.ConstraintViolationException, ConstraintViolationImpl{interpolatedMessage='may not be null', propertyPaJava

Java-Forum
Guest
 Javax.validation.ConstraintViolationException, ConstraintViolationImpl{interpolatedMessage='may not be null', propertyPa

Post by Guest »

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):

Code: Select all

 
Beim Speichern eines Objekts erhalte ich Folgendes:

Code: Select all

 javax.validation.ConstraintViolationException, ConstraintViolationImpl{interpolatedMessage='may not be null', propertyPath=workflow
Klasse DocumentType:

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);
}
}
Klassen-Workflow:

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;
}
Was mache ich falsch?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post