I have seen a few questions about this but I am unable to derive a solution to my problem.
我有以下<代码>PositionHistory 宣布的实体......
@Entity
@Table(name = "position_history")
@Cache (usage=CacheConcurrencyStrategy.READ_WRITE)
@AttributeOverride (name="id", column = @Column(name=PositionHistory.PRIMARY_KEY))
public class PositionHistory extends AbstractPersistable {
public static final String PRIMARY_KEY = "s_posn_history_id";
public static final String KEY = "positionHistory";
public static final String KEY_DATE = "date";
public static final String KEY_COMMENT = "comment";
// String field length definitions
public static final int LENGTH_COMMENTS = 1000;
// Instance Variables
private Date date;
private String comment;
@Column(name = "d_date", nullable = false)
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@Column(name = "t_comment", length = LENGTH_COMMENTS)
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
// hashCode()
// equals()
// toString()
}
载于<代码>。 履历: 我试图删除一些行文......
public void deletePositionHistory(Long positionId) {
getSession().createQuery("delete from position_history a where a.position_id=:id")
.setParameter("id", positionId).executeUpdate();
}
电话:deletePositionHistory
我有以下错误......
ERROR a.g.q.d.v.s.c.CommandProcessorImpl:75 - org.hibernate.hql.ast.QuerySyntaxException: position_history is not mapped
如你所知,该表已在<条码>中绘制。 实体和<代码>PositionHistoryDaoImp延伸至该实体。
我失踪或作错了吗?
你的帮助非常受赞赏。
谢谢。
www.un.org/Depts/DGACM/index_russian.htm
@Entity
@Table(name = "position")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@AttributeOverride(name = "id", column = @Column(name = Position.PRIMARY_KEY))
public class Position extends AbstractPersistableEffective {
...
public static final String PRIMARY_KEY = "s_posn_id";
public static final String KEY_ID = "positionId";
private List<PositionHistory> history = new ArrayList<PositionHistory>();
...
@OneToMany(fetch = FetchType.LAZY)
@Cascade({CascadeType.ALL, CascadeType.DELETE_ORPHAN})
@JoinColumn(name = Position.PRIMARY_KEY)
@IndexColumn(name = AbstractPersistable.INDEX_COLUMN)
public List<PositionHistory> getHistory() {
return history;
}
public void setHistory(List<PositionHistory> history) {
this.history = history;
}
}