如何解决基于非唯一键的组合删除记录列表弹簧数据jpa
Tournament
-------
1. Id
2. player_id
3. team_id
4. coach_id
Entity Class :
public class Tourament{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name="player_id",columnDeFinition="int(20) NOT NULL")
private Long playerId;
@Column(name="team_id",columnDeFinition="int(20) NOT NULL")
private Long teamId;
@Column(name="coach_id",columnDeFinition="int(20) NOT NULL")
private Long coachId;
}
我要实现的是在Spring JPA中执行以下MySQL查询。
MysqL> delete from tournament where (player_id,team_id,coach_id) in ((101,5,3),(102,2,3));
@Query("delete from tournament where (player_id,coach_id) in (?1)")
void deleteByTuples(List<MyClass> tuples);
public class MyClass{
private Integer player_id;
private Integer team_id;
private Integer coach_id;
}
如何使用Spring JPA实现这一目标?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。