我有实体Car和User
@Entity
public class Car{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
long id;
String name;
........
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
long id;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
List<Car> carList;
.......
我成功地能够保存实体用户,但是当尝试用新车更新用户(即添加新车)时
user.addCars(car);
updateUser(user);
它给予例外
Hibernate Exception Could not execute JDBC batch update