Last active
July 13, 2018 06:24
-
-
Save mohamed-gara/788c7b2c6d9822acb1766d305a3a9e0f to your computer and use it in GitHub Desktop.
Already in the persistence context
This file contains 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
@Test | |
public void lazyLoaded() { | |
Person husband = entityManager.find(Person.class, HUSBAND_ID); | |
assertThat(husband).hasLazyLoaded("wife"); | |
} | |
@Test | |
public void alreadyLoaded() { | |
entityManager.find(Person.class, WIFE_ID); | |
Person husband = entityManager.find(Person.class, HUSBAND_ID); | |
assertThat(husband).hasEagerlyLoaded("wife"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment