I am the following Hibernate
Entity:
@Entity(name = "status")
@Table(name = "status")
public class Status implements Serializable {
@Id
@JsonProperty
@Column(name = "status_id")
private Integer statusId;
@JsonProperty
@Column(name = "status_label")
private String statusLabel;
@JsonProperty
@Transient
private String statusOrigin;
}
statusOrigin
is transient as it is not a column in the status
table.
This works fine for creating the object with only statusId
and statusLabel
fields as expected.
However when I want to return the Status object to the front end with a join query which populates all 3 fields it does not work as statusOrigin
is transient.
How can I do the following:
You can add insertable and updatable false to the field
@Column(name="statusOrigin",insertable=false,updatable=false)