hibernate跟spring都是用annotation,
Board:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public int getId() {
return id;
}
File:
@OneToOne(cascade = CascadeType.ALL)
public Board getBoard() {
return board;
}
在执行插入的时候报错
Hibernate: insert into t_file (board_id, dataLevel, descript, downCount, downScore, fileName, fileNameInServer, path, sufName, tag, uploadTime, user_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
20:54:44,718 WARN org.hibernate.util.JDBCExceptionReporter:77 - SQL Error: 1364, SQLState: HY000
20:54:44,718 ERROR org.hibernate.util.JDBCExceptionReporter:78 - Field 'boardId' doesn't have a default value
求解~~~