I created a restful webservice using netbeans created a entity class from the database and restful web services from entity class using jpa but i used tomcat as my server now the post method below wont insert the following json into the database but when i use glassfish as my server it works. Do you think I am missing any dependencies ? How can I emulate the glassfish?
I am trying to insert
{
"acceptedGender":"both",
"price":123123.00,
"type":"apartment"
"vacantNum":13,
"hadID":4
}
I have the following dependencies:
javaee-api-7.0.jar
javax.ejb-api.jar
mysql-connector-java-5.1.42-bin.jar
@POST
@Override
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void create(Students entity) {
super.create(entity);
}`
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "hatID")
private Integer hatID;
@Basic(optional = false)
@Column(name = "type")
private String type;
@Basic(optional = false)
@Column(name = "acceptedGender")
private String acceptedGender;
@Basic(optional = false)
@Column(name = "vacantNum")
private int vacantNum;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields
consider using these annotations to enforce field validation
@Basic(optional = false)
@Column(name = "price")
private BigDecimal price;
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "hatID")
// private Collection<Reservation> reservationCollection;
@JoinColumn(name = "hadID", referencedColumnName = "hadID")
@ManyToOne(optional = false)
private HaDetails hadID;
public HaTypes(Integer hatID, String type, String acceptedGender, int
vacantNum, BigDecimal price) {
this.hatID = hatID;
this.type = type;
this.acceptedGender = acceptedGender;
this.vacantNum = vacantNum;
this.price = price;`
Or if you dont have a solution to my problem could you recommend any provider aside from aws(dont have the time to study the docker), openshift and jelastic that could deploy a glassfish restful webservice on cloud easily.