Skip to content

Instantly share code, notes, and snippets.

@JamesZoft
Last active April 4, 2018 14:55
Show Gist options
  • Save JamesZoft/69a7a40ce574e7f5ca9b689de7ada5dd to your computer and use it in GitHub Desktop.
Save JamesZoft/69a7a40ce574e7f5ca9b689de7ada5dd to your computer and use it in GitHub Desktop.
List<Container> containers = session.createNativeQuery("select * from containers c", Container.class)
.list();
containers.forEach(container -> {
SubEntity subEntity = session.createNativeQuery("select * from subEntity se join containers c on se.id = c.fk_se where c.id = :id")
.setParameter("id", container.getId())
.uniqueResult();
container.setSubEntity(subEntity);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment