Skip to content

Instantly share code, notes, and snippets.

@takahashi-h5
Last active August 22, 2020 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takahashi-h5/b30aed85e103a773a9c65a8bb4644ffd to your computer and use it in GitHub Desktop.
Save takahashi-h5/b30aed85e103a773a9c65a8bb4644ffd to your computer and use it in GitHub Desktop.
@PersistenceContext(unitName = "default") // @PersistenceContext() と同じ
private EntityManager entityManager;
@RequestMapping(path = "/test", method = RequestMethod.GET)
public ResponseEntity<?> test() {
var ret =
entityManager.createNativeQuery("select * from t_employee", Employee.class).getResultList();
return ResponseEntity.ok(Map.of("result", ret));
}
// windows
// curl -X GET http://localhost:8080/test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment