add test coverage for Option and Stream return types
This commit is contained in:
parent
50c67a410e
commit
bfce032efc
|
@ -12,6 +12,8 @@ import org.hibernate.query.SelectionQuery;
|
|||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public interface Dao {
|
||||
|
||||
|
@ -20,6 +22,9 @@ public interface Dao {
|
|||
@Find
|
||||
Book getBook(String isbn);
|
||||
|
||||
@Find
|
||||
Optional<Book> getBookIfAny(String isbn);
|
||||
|
||||
@Find(enabledFetchProfiles="Goodbye")
|
||||
Book getBookFetching(String isbn);
|
||||
|
||||
|
@ -47,6 +52,9 @@ public interface Dao {
|
|||
@HQL("where title like ?1")
|
||||
List<Book> findBooksByTitle(String title);
|
||||
|
||||
@HQL("where title like ?1")
|
||||
Stream<Book> streamBooksByTitle(String title);
|
||||
|
||||
@HQL("from Book where title like ?1")
|
||||
TypedQuery<Book> findByTitle(String title);
|
||||
|
||||
|
@ -89,6 +97,9 @@ public interface Dao {
|
|||
@HQL("from Book where isbn = :isbn")
|
||||
Book findByIsbn(String isbn);
|
||||
|
||||
@HQL("from Book where isbn = :isbn")
|
||||
Optional<Book> findByIsbnIfExists(String isbn);
|
||||
|
||||
@SQL("select * from Book where isbn = :isbn")
|
||||
Book findByIsbnNative(String isbn);
|
||||
|
||||
|
|
Loading…
Reference in New Issue