| .. | .. |
|---|
| 9 | 9 | import javax.persistence.CascadeType; |
|---|
| 10 | 10 | import javax.persistence.Column; |
|---|
| 11 | 11 | import javax.persistence.Entity; |
|---|
| 12 | +import javax.persistence.FetchType; |
|---|
| 12 | 13 | import javax.persistence.GeneratedValue; |
|---|
| 13 | 14 | import javax.persistence.Id; |
|---|
| 14 | 15 | import javax.persistence.JoinColumn; |
|---|
| .. | .. |
|---|
| 36 | 37 | @Entity |
|---|
| 37 | 38 | @Table(name = "organization") |
|---|
| 38 | 39 | @NamedQueries( |
|---|
| 39 | | - { @NamedQuery(name = "list-organizations", query = "SELECT o FROM Organization o"), @NamedQuery(name = "find-children-org", query = "SELECT o FROM Organization o where o.parentOrganization = :parentOrganization") }) |
|---|
| 40 | + { @NamedQuery(name = "list-organizations", query = "SELECT o FROM Organization o"), @NamedQuery(name = "list-organizations-by-ids", query = "SELECT o FROM Organization o where id in :list_ids"), |
|---|
| 41 | + @NamedQuery(name = "find-children-org", query = "SELECT o FROM Organization o where o.parentOrganization = :parentOrganization") }) |
|---|
| 40 | 42 | public class Organization implements Serializable { |
|---|
| 41 | 43 | |
|---|
| 42 | 44 | @SuppressWarnings("unused") |
|---|
| .. | .. |
|---|
| 73 | 75 | |
|---|
| 74 | 76 | @JsonIgnore |
|---|
| 75 | 77 | // We don't include the users to limit the size of each row a the listing |
|---|
| 76 | | - @OneToMany(mappedBy = "parentOrganization") |
|---|
| 78 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "parentOrganization") |
|---|
| 77 | 79 | private Set<Organization> childOrganizations; |
|---|
| 78 | 80 | |
|---|
| 79 | 81 | public int getId() { |
|---|