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
import { Component, DoCheck } from '@angular/core'; | |
@Component({ | |
selector: 'app', | |
template: ` | |
<h3>On each button click a single ApplicationRef.tick() is triggered</h3> | |
<div>Counter: {{ counter }}</div> | |
<div> |
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
import { Component, DoCheck } from '@angular/core'; | |
@Component({ | |
selector: 'app', | |
template: ` | |
<h3>On each button click two ApplicationRef.tick() are triggred</h3> | |
<div> | |
<div>Counter: <input [ngModel]="counter" #counterValue="ngModel"></div> | |
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
import { Component, DoCheck } from '@angular/core'; | |
@Component({ | |
selector: 'app', | |
template: ` | |
<h3>Change detection hell loop</h3> | |
<div>Counter: {{ counter }}</div> | |
<div> |
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 basicAttributeIsNotLazyLoaded() { | |
Person person = entityManager.find(Person.class, PERSON_ID); | |
assertThat(person).hasEagerlyLoaded("comment"); | |
} |
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
@Data(PersonEntityTable.class) | |
public class BasicAttributeTestCase extends EntityLoadingTestCase { | |
@Test | |
public void basicAttributeIsNotLazyLoaded() { | |
Person person = entityManager.find(Person.class, PERSON_ID); | |
assertThat(person).hasEagerlyLoaded("comment"); | |
} | |
} |
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
@Entity | |
@Data | |
public class Person extends core.Person { | |
@Basic(fetch = LAZY) | |
@Lob | |
private String comment; | |
} |
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
@Entity | |
@Data | |
public class Person extends core.Person { | |
@OneToOne(fetch = LAZY) | |
private Person wife; | |
@OneToOne(fetch = LAZY, mappedBy = "wife") | |
private Person husband; | |
public Person getPartner() { |
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 inverseSideRelationshipIsNotLazyLoaded() { | |
Person person = entityManager.find(Person.class, WIFE_ID); | |
assertThat(person).hasEagerlyLoaded("husband"); | |
} |
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
@Entity | |
@Data | |
public class Person extends core.Person { | |
@ManyToOne(fetch = LAZY) | |
@NotFound(action = NotFoundAction.IGNORE) | |
private Person mother; | |
@ManyToOne(fetch = LAZY) | |
@NotFound(action = NotFoundAction.EXCEPTION) | |
private Person father; |
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 entityIsNotLazyLoaded() { | |
Person person = entityManager.find(Person.class, PERSON_ID); | |
assertThat(person) | |
.hasEagerlyLoaded("mother") | |
.hasLazyLoaded("father"); | |
} |
OlderNewer