Skip to content

Commit

Permalink
#22 - add query override since PGSQL doesn't have the trunc() functio…
Browse files Browse the repository at this point in the history
…n for dates
  • Loading branch information
cbellone committed Dec 28, 2014
1 parent 04a33b5 commit bdcb408
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*/
package alfio.repository;

import alfio.datamapper.Bind;
import alfio.datamapper.Query;
import alfio.datamapper.QueryRepository;
import alfio.datamapper.*;
import alfio.model.TicketReservation;

import java.time.ZonedDateTime;
Expand Down Expand Up @@ -47,6 +45,7 @@ int postponePayment(@Bind("reservationId") String reservationId, @Bind("validity
List<String> findAllReservationsWaitingForPayment();

@Query("select * from tickets_reservation where status = 'OFFLINE_PAYMENT' and trunc(validity) <= :expiration and reminder_sent = false")
@QueriesOverride(@QueryOverride(value = "select * from tickets_reservation where status = 'OFFLINE_PAYMENT' and date_trunc('day', validity) <= :expiration and reminder_sent = false", db = "PGSQL"))
List<TicketReservation> findAllOfflinePaymentReservationForNotification(@Bind("expiration") Date expiration);

@Query("update tickets_reservation set reminder_sent = true where id = :reservationId")
Expand Down

0 comments on commit bdcb408

Please sign in to comment.