在更新中引用联接类型的字段

时间:2014-12-16 09:22:07

标签: hibernate jpa hql

我有继承问题:

类Item和类User从Item

扩展
@Inheritance(strategy= InheritanceType.JOINED)
@Entity
@Table(name = "item")
public class Item{
    ...
    Date lastdate;
}

@Entity
@Table(name = "user")
public class User extends Item{
    ...
    Date logindate
}

我想做这个查询:

update User u set u.lastdate=u.logindate where u.id = ?1

但它抛出异常:Unknown column 'logindate' in 'field list',因为它试图执行此操作:

update item set lastdate=logindate where (item_id) IN (select item_id from HT_user)

如何在HQL Update查询中引用item.lastdate和user.logindate?

0 个答案:

没有答案