我正在使用Spring Data,我创建了包含在"AbstractEntity"中的实体,所有对象都扩展为获取基本列
AbstractEntity:
@MappedSuperclass public abstract class AbstractEntity implements Serializable{ @Temporal(TemporalType.TIMESTAMP) @Column(nullable = false) private Date CreatedDate; @PrePersist protected void onCreate() { UpdatedDate = CreatedDate = new Date(); } ...
和我的对象/实体
@Entity public class Trade extends AbstractEntity {
当我尝试使用我的存储库创建方法时 findByCreatedDateAfter(Date date)
我得到一个例外,无法找到该列......?
public interface TradeRepository extends CrudRepository{ public List findByCreatedDateAfter(Date date); }
它编译(如果我使用某些capitolization)但是试图映射查询,我得到:
Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [createdDate] on this ManagedType [streaming.data.AbstractEntity]
我还想返回sum(amount)
此期间的金额列之一.