Hibernate 语法
如果有@OneToOne注解的 B对象在A对象中,如何给该A对象的关系属性赋值
例如:
@Entity
@DynamicInsert(true)
@DynamicUpdate(true)
public class Log {
@Id
@Column(name = "ID", length = 32,columnDefinition="varchar(32) default '' COMMENT 'ID'")
@GenericGenerator(name = "system-uuid",strategy = "uuid")
@GeneratedValue(generator = "system-uuid")
private String id;
@JsonIgnore
@NotFound(action= NotFoundAction.IGNORE)
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "workshop")
@ColumnInfo(type = "varchar")
private SysWorkshopFiles workshopFile;
}
SysWorkshopFiles 对象的ID与LOG表的workshop字段关联,如果要给workshop字段赋值,则前端对
象data中,workshop字段在A对象中”不需生成该属性,也不需要get/set“。
var data = serializeObject($('form'));
data["workshopFile.id"]=xxx;
“data[“workshopFile.id”]=xxx” 对workshop字段赋值