基于非唯一键的组合删除记录列表弹簧数据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 (将#修改为@)