Minha conexão dá erro 400
mensagem: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing)
meu código:
import javax.persistence.EntityManager; import javax.persistence.PersistenceContext;
import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional;
import br.com.ihsl.cq.models.Amostra;
@Repository @Transactional public class AmostrasDAO {
@PersistenceContext
private EntityManager manager;
public void gravar(Amostra amostra) {
manager.persist(amostra);
System.out.println("inserido");
}
}
@Entity @Table(name = "AMOSTRA") public class Amostra {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String numero;
private String perfil;
private String cliente;
private double volume;
private Date dataEntrada;
private Date dataColeta;
private Date dataLaudo;
private String lote;
public String toString() {
return "Amostra[amostra =" + numero + "perfil =" + perfil + "cliente =" + cliente + ", volume=" + volume + ", dataEntrada=" + dataEntrada + ", dataColeta="
+ dataColeta + ", lote" + lote;
package br.com.ihsl.cq.controllers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping;
import br.com.ihsl.cq.daos.AmostrasDAO; import br.com.ihsl.cq.models.Amostra;
@Controller public class InserirController {
@Autowired
private AmostrasDAO dao;
@RequestMapping("/inserir-amostra")
public String iserir() {
System.out.println("Cadastro CQ");
return "cadastro";
}
@RequestMapping(value ="/ok")
public String gravar(Amostra amostra) {
System.out.println(amostra);
dao.gravar(amostra);
return "ok";
}
}
package br.com.ihsl.cq.conf;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.view.InternalResourceViewResolver;
import br.com.ihsl.cq.controllers.HomeController; import br.com.ihsl.cq.daos.AmostrasDAO;
@EnableWebMvc @ComponentScan(basePackageClasses= {HomeController.class, AmostrasDAO.class }) public class AppWebConfiguration {
@Bean
public InternalResourceViewResolver internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
}