Last active
July 11, 2016 12:52
-
-
Save thjanssen/6b233c442233ef914d51c076e1860b2c 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
Book b = (Book) em.createNativeQuery("SELECT * FROM book b WHERE id = 1", Book.class).getSingleResult(); |
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
em.createNativeQuery("SELECT * FROM book b WHERE id = 1", "BookMapping").getSingleResult(); |
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
@SqlResultSetMapping( | |
name = "BookMapping", | |
entities = @EntityResult( | |
entityClass = Book.class, | |
fields = { | |
@FieldResult(name = "id", column = "id"), | |
@FieldResult(name = "version", column = "version"), | |
@FieldResult(name = "title", column = "title"), | |
@FieldResult(name = "publishingDate", column = "publishingDate"), | |
@FieldResult(name = "publisher", column = "publisherid")})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment