我有以下HQL:
String hql = "UPDATE Buchung as b " + "set STORNO = :Storno " + "where ID = :BuchungID";
是否可以在HQL中更新多于一列的数据?例如:
String hql = "UPDATE Buchung as b " + "set STORNO = :Storno " + "set NAME = :Name " + ...... "where ID = :BuchungID";
我知道如何在MSSQL中做到这一点,但我不知道如何在Hibernate中做到这一点。
在这种情况下,HQL与SQL相同。只需使用逗号分隔各列:
String hql = "UPDATE Buchung as b set " + "STORNO = :Storno," + "NAME = :Name " + ...... "where ID = :BuchungID";