Skip to content

Instantly share code, notes, and snippets.

@thjanssen
Last active April 13, 2018 13:37
Show Gist options
  • Save thjanssen/09fbbea60d4e8e7716ff06099257637f to your computer and use it in GitHub Desktop.
Save thjanssen/09fbbea60d4e8e7716ff06099257637f to your computer and use it in GitHub Desktop.
@SqlResultSetMapping(name = "BookValueMapping",
classes = @ConstructorResult(
targetClass = BookValue.class,
columns = {@ColumnResult(name = "title"),
@ColumnResult(name = "date")}
)
)
BookValue b = (BookValue) em.createNativeQuery("SELECT b.publishingDate as date, b.title, b.id FROM book b WHERE b.id = 1", "BookValueMapping").getSingleResult();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment