I was making a rest call to Spring Controller, it failed to got through with BAD request (400 cause , original question Spring Controller 400 (Bad Request))
My Initial rest call parameters were:
categoty: "Game"
itemDescription: "adas"
itemDiscount: 1
itemName: "asdas"
itemPrice: 1
itemQuantity: 1
This failed , but when I changed the parameters as below , it worked:
categoty: "Game"
description: "test1"
discount: 10
name: "Test"
price: 10
quantity: 10
My Persistence POJO class was :
import javax.persistence.*;
@Entity
@Table(name= "Item")
public class Item {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="id")
private int id;
private String itemName,itemDescription,categoty;
private double itemPrice;
private float itemDiscount;
private int itemQuantity;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getQuantity() {
return itemQuantity;
}
public void setQuantity(int quantity) {
this.itemQuantity = quantity;
}
public float getDiscount() {
return itemDiscount;
}
public void setDiscount(float discount) {
this.itemDiscount = discount;
}
public double getPrice() {
return itemPrice;
}
public void setPrice(double price) {
this.itemPrice = price;
}
public String getName() {
return itemName;
}
public void setName(String iName) {
this.itemName = iName;
}
public String getDescription() {
return itemDescription;
}
public void setDescription(String desc) {
this.itemDescription = desc;
}
public String getcategoty() {
return categoty;
}
public void setcategoty(String cat) {
this.categoty = cat;
}
}
Can someone help me understand why second type of parameters worked , whereas first one didn't (Ideally first one was one to one mapping to properties in persistence class)?