Infinite recursion (StackOverflowError) (through reference chain: org.springframework.data.rest.webmvc.EntityResource["[anySetter]"]->java.util.LinkedHashMap["addressByAddressCustomerId"]->java.util.LinkedHashMap["value"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->org.springframework.hateoas.Resource["content"]->...@Entity
@Table(name = "ORDER")
public class Order implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Location location;
public Order() {
}
@SequenceGenerator(name = "OrderSequence", sequenceName = "ORDER_SEQ", allocationSize = 1)
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "OrderSequence")
@Column(name = "ID", unique = true, nullable = false, precision = 9, scale = 0)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LOCATION_ID", nullable = false)
public Location getLocation() {
return this.location;
}
public void setLocation(Location location) {
this.location = location;
}
}
@Entity
@Table(name="LOCATION"
)
public class Location implements java.io.Serializable {
private String id;
private String description;
private Set<Order> orders = new HashSet<Order>(0);
@Id
@Column(name="ID", unique=true, nullable=false, length=64)
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
@Column(name="DESCRIPTION", nullable=false, length=64)
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="location")
public Set<Order> getOrders() {
return this.orders;
}
public void setOrders(Set<Order> orders) {
this.orders = orders;
}
}
The problem you encounter is reproducible when @ManyToOne annotation has fetch = FetchType.LAZY
A bug has been submitted about this - https://github.com/max-dev/light-admin/issues/105
Until the bug is fixed, you can use workaround: remove fetch = FetchType.LAZY from @ManyToOne annotations in your entities.
Hope this is suitable for you.
Best regards,
Iryna Kostenko