Last active
August 9, 2016 16:47
-
-
Save thjanssen/455628f3712f9e4b5c9d245a40b72e5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Book> books = session.createQuery("SELECT b FROM Book b", Book.class).list(); | |
books.stream() | |
.map(b -> b.getTitle() + " was published on " + b.getPublishingDate()) | |
.forEach(m -> log.info(m)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream<Book> books = session.createQuery("SELECT b FROM Book b", Book.class).stream(); | |
books.map(b -> b.getTitle() + " was published on " + b.getPublishingDate()) | |
.forEach(m -> log.info(m)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream<BookValue> books = session.createQuery("SELECT new org.thoughts.on.java.model.BookValue(b.title, b.publishingDate) FROM Book b", BookValue.class).stream(); | |
books.map(b -> b.getTitle() + " was published on " + b.getPublishingDate()) | |
.forEach(m -> log.info(m)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream<Object[]> books = session.createNativeQuery("SELECT b.title, b.publishingDate FROM book b").stream(); | |
books.map(b -> new BookValue((String)b[0], (Date)b[1])) | |
.map(b -> b.getTitle() + " was published on " + b.getPublishingDate()) | |
.forEach(m -> log.info(m)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment