我正在尝试更新实体的属性,但我得到了
java.lang.IllegalArgumentException: node to traverse cannot be null!
该方法的主体包含问题:
sessionFactory.getCurrentSession()
.createQuery("UPDATE Author SET expiredDate = :date where id = :id")
.setParameter("date", new Date())
.setParameter("id", id).executeUpdate();
作者实体类:
@Entity
@Table(name = "authors")
@SequenceGenerator(name = "AUTHORS_SEQ", sequenceName = "AUTHORS_SEQ")
public class Author implements Serializable {
@Id
@Column(name = "author_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AUTHORS_SEQ")
private Long id;
@Column(name = "author_name")
private String name;
@Column(name = "expired")
private Date expiredDate;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "NEWS_AUTHORS", joinColumns = {@JoinColumn(name = "AUTHOR_ID")}, inverseJoinColumns = {@JoinColumn(name = "NEWS_ID")})
private Set<News> newsSet;
//... getters and setters ...
我的查询有什么问题?