所以,我正在进行EasyCriteria查询。
我有一个映射的超类:
@MappedSuperclass
public abstract class CreatedEntity extends IdEntity implements Creatable {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name="fk_creation_userid")
protected UserId creationUserId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name="creation_date")
protected Date creationDate;
然后我有一个创建EasyCriteria查询的子类:
@Entity
@Table(name = "assignment")
public class Assignment extends CreatedEntity {
final EasyCriteria<Assignment> ec = easyCriteria(Assignment.class);
ec.setDistinctTrue();
...
UserId assignmentGiver = searchTerms.getAssignmentGiver();
if (assignmentGiver != null) {
ec.andEquals("creationUserId", assignmentGiver);
}
Date startDate = searchTerms.getStartDate();
if (startDate != null) {
ec.andGreaterOrEqualTo("creationDate", startDate);
}
现在,creationUserId搜索有效,但EasyCriteria声称超类没有creationDate属性,即使它确实如此。 creationUserId查询工作正常,它是来自完全相同的超类的属性。
我得到的例外是:
We could not find the parameter: creationDate in the given class: class ...[path]...Assignment
有什么问题?我花了近两天时间试图解决这个问题。
其他兴趣点:
那么为什么andGreaterOrEqualTo-method不能与在超类中映射的Date属性一起使用?