型号:
@Entity public class Team {
Long teamId;
String teameName;
@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "TEAM_ID", nullable = false)
private Set<Player> players;
/**
more code for getters and setter for all fields
*/
}
@Entity
public class Player {
String PlayerName,
String address
/**
*more code for getters and setter for everything
*/
}
我正在尝试一个看起来不起作用的HQL更新查询:
"update " + Team.class.getName() + " set teameName = :teameName, players = :players where teamId = :teamId";
我得到的例外是:Missing IN or OUT parameter at index
。
那么实现同样目标的正确方法是什么。