How can i add an object to a Entity class without getting saved to DB.
Use the following annotations before the embedded object within the entity
@JsonInclude @Transient @Embedded
@Entity
public class MillingData {
public MillingData() {
super();
}
@Id
@GeneratedValue
private String id;
private String name;
private Float depth;
@JsonInclude
@Transient
@Embedded
private UnitData unitData;
Also use the annotation within the embedded object class definition
@Embeddable
public class UnitData {
private String id;
private Map map;
public Map getMap() {
return map;
}
Hope this helps
No comments:
Post a Comment