我有继承问题:
类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?