Skip to content

Instantly share code, notes, and snippets.

@B4nan
Last active February 6, 2022 18:29
Show Gist options
  • Select an option

  • Save B4nan/aeac8b5ebd93c8042007b658c2ec349d to your computer and use it in GitHub Desktop.

Select an option

Save B4nan/aeac8b5ebd93c8042007b658c2ec349d to your computer and use it in GitHub Desktop.
// querying for author will trigger auto-flush if we have new author persisted
const a1 = new Author(...);
em.persist(a1);
const r1 = await em.find(Author, {});
// querying author won't trigger auto-flush if we have new book, but no changes on author
const b4 = new Book(...);
em.persist(b4);
const r2 = await em.find(Author, {});
// but querying for book will trigger auto-flush
const r3 = await em.find(Book, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment