Rev 760 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 760 | Rev 761 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | package br.com.sl.repository.jpa; |
1 | package br.com.sl.repository.jpa; |
| - | 2 | ||
| - | 3 | import java.time.LocalDateTime; |
|
| - | 4 | import java.util.List; |
|
| 2 | 5 | ||
| 3 | import org.springframework.stereotype.Repository; |
6 | import org.springframework.stereotype.Repository; |
| 4 | 7 | ||
| - | 8 | import br.com.ec.domain.dto.CompraProdutoDTO; |
|
| 5 | import br.com.sl.domain.model.Candle; |
9 | import br.com.sl.domain.model.Candle; |
| 6 | import br.com.sl.repository.CandleRepository; |
10 | import br.com.sl.repository.CandleRepository; |
| 7 | import br.com.sl.repository.SistemaAbstractRepository; |
11 | import br.com.sl.repository.SistemaAbstractRepository; |
| 8 | 12 | ||
| 9 | @Repository |
13 | @Repository |
| 10 | public class CandleRepositoryJpaImpl extends SistemaAbstractRepository<Candle> implements CandleRepository { |
14 | public class CandleRepositoryJpaImpl extends SistemaAbstractRepository<Candle> implements CandleRepository { |
| 11 | 15 | ||
| 12 | - | ||
| - | 16 | @Override |
|
| - | 17 | public List<Candle> consultarAtivosComCandleEncerradoAte(LocalDateTime fimUltimoCandle) { |
|
| - | 18 | StringBuilder jpql = new StringBuilder(); |
|
| - | 19 | jpql.append("SELECT * FROM Candle e"); |
|
| - | 20 | jpql.append("WHERE e.dataHora <= :fimUltimoCandle "); |
|
| - | 21 | try { |
|
| - | 22 | jpql.append("ORDER BY e.dataHora DESC"); |
|
| - | 23 | return getEntityManager().createQuery(jpql.toString(), Candle.class) |
|
| - | 24 | .setParameter("fimUltimoCandle", fimUltimoCandle) |
|
| - | 25 | .getResultList(); |
|
| - | 26 | } catch(Exception ex) { |
|
| - | 27 | ex.printStackTrace(); |
|
| - | 28 | return null; |
|
| - | 29 | }
|
|
| - | 30 | }
|
|
| 13 | 31 | ||
| 14 | }
|
32 | }
|