I use Spring Data, I created my entities wrapped inside "AbstractEntity", which all objects propagate to the base columns
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();
}
...
And my object / object
@Entity
public class Trade extends AbstractEntity {
When I try to use my repository to create a method findByCreatedDateAfter(Date date)
I get an exception that the column cannot be found ...?
public interface TradeRepository extends CrudRepository<Trade, Long>{
public List<Trade> findByCreatedDateAfter(Date date);
}
It compiles (if I use specific capitolization), but than trying to match the request, I get:
Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [createdDate] on this ManagedType [streaming.data.AbstractEntity]
I would also like to return sum(amount)one of the quantity columns for this period.
Any advice appreciated!
thanks
source
share