Answer the question
In order to leave comments, you need to log in
Ebean: Replacing SqlSelect with RawSql
There is this class:
import com.avaje.ebean.annotation.*;
import org.joda.time.LocalDate;
import javax.persistence.Entity;
@Entity
@Sql(select = {
@SqlSelect(
name="default",
query="SELECT DATE(`o`.`date`) AS `date`, COUNT(`o`.`id`) AS `total` FROM `orders` `o` GROUP BY DATE(`o`.`date`)"
)
})
public class OrdersReport {
public LocalDate date;
public Long total;
}
Ebean.find(OrdersReport.class)
.where()
.ge("date", startDate)
.le("date", endDate);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question