I have been working on indiviual project and unable to fix this error.
I am new to Spring boot and rest controller. it's giving infinite output when i return my Product entity from RestController to my postman. please provide me some suggestion.
I am using mysql database
package com.example.hackernews.entity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
@Table(name = "products")
public class Product {
@Id
@Column(name = "id", nullable = false, unique = true)
@GeneratedValue(strategy = GenerationType.IDENTITY)
int id;
@Column(name = "name")
String name;
@Column (name="price")
Interger price;
@JoinColumn(name = "customer_id")
@ManyToOne
Customer customer;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name ) {
this.name = name;
}
public Integer getPrice() {
return price;
}
public void setPrice(Interger price ) {
this.price = price;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer ) {
this.customer = customer;
}
}
Thanks in advance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…