1
votes

I get Ebean for the most part but how would I do this:

select s.id, s.name, s.city, b.date
from seat s
left join booking b on (s.id = b.listing_id)
  and b.date >= '2011-09-05'

If it wasn't for the second condition on the join (and b.date >= '2011-09-05') it would have been easy...

Thanks!

1

1 Answers

0
votes

If exists in class Seat, a ManyToMany (or OneToMany) relationship to Booking and if field date in Booking is of type Date, then this code could be work :

Finder<XXX, Booking> finder = new Finder<>(XXX.class, Booking.class);
DateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd");
FIND
   .fetch("seat")
   .where()
   .ge("date", dateFormat.parse("2011-09-05"))
   .findList()