具有OneToMany关系的实体的HQL更新查询

时间:2016-06-27 08:00:33

标签: oracle hibernate hql

型号:

@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

那么实现同样目标的正确方法是什么。

0 个答案:

没有答案