Spring Hibernate : error 400 "the request sent by client was syntactically incorrect"

By sanjay

This is my semester.java class

    @Entity
    @Table(name = "semester")
    @NamedQueries({
        @NamedQuery(name = "Semester.findAll", query = "SELECT s FROM Semester s")})
    public class Semester implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Basic(optional = false)
        @Column(name = "id")
        private Integer id;
        @OneToMany(mappedBy = "semesterid")
        private List<Marks> marksList;
        @JoinColumn(name = "facultyid", referencedColumnName = "facultyid")
        @ManyToOne
        private Faculty facultyid;
        @JoinColumn(name = "semesterid", referencedColumnName = "semesterid")
        @ManyToOne
        private Semestername semesterid;
        @JoinColumn(name = "subjectcode", referencedColumnName = "subjectcode")
        @ManyToOne
        private Subject subjectcode;
        public Semester() {
        }
        public Semester(Integer id) {
            this.id = id;
        }
        public Integer getId() {
            return id;
        }
        public void setId(Integer id) {
            this.id = id;
        }
        public List<Marks> getMarksList() {
            return marksList;
        }
        public void setMarksList(List<Marks> marksList) {
            this.marksList = marksList;
        }
        public Faculty getFacultyid() {
            return facultyid;
        }
        public void setFacultyid(Faculty facultyid) {
            this.facultyid = facultyid;
        }
        public Semestername getSemesterid() {
            return semesterid;
        }
        public void setSemesterid(Semestername semesterid) {
            this.semesterid = semesterid;
        }
        public Subject getSubjectcode() {
            return subjectcode;
        }
        public void setSubjectcode(Subject subjectcode) {
            this.subjectcode = subjectcode;
        }
    }

This is the admin controller

    @Controller
    public class AdminController {
        @Autowired
        AdminDao adminDao;
     @RequestMapping(value="/addsemester",method=RequestMethod.GET)
        public String addsemester(Model model){
            model.addAttribute("semesterlist", new Semester());
            return "semesterentry";
        }
         @RequestMapping(value="/addsemester",method=RequestMethod.POST)
        public String _addsemester(@ModelAttribute("semesterlist") Semester semester){
            boolean check = adminDao.insertsemester(semester);
            if(check){
                return "redirect:/addsemester";
            }
            else{
            return "dashboard";
        }
        }
    }

This is the admindaoImpl.java class and when i used to insert the semester 400 error with the syntically incorrect was faced.

    @Repository("adminDao")
    public class AdminDaoImpl implements AdminDao {
        @Autowired
        SessionFactory sessionFactory;
    @Transactional
         public boolean insertsemester(Semester semester){
              boolean check = false;
            try {
                sessionFactory.getCurrentSession().save(semester);
            } catch (Exception e) {
            }
            if(sessionFactory.getCurrentSession().save(semester)!=null){
                check = true;
            }
            return check;
         }
    }

and when i try to insert the data to database i got 400 error. and i have check all the value of jsp name with database again i got a problem on these.

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273