Announcement Announcement Module
Collapse
No announcement yet.
Problem Insert Register JPA + Hibernate in STS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem Insert Register JPA + Hibernate in STS

    I´m trying to save an entry from a form using JPA+Hibernat, but the following error message comes up:

    GRAVE: El Servlet.service() para el servlet [appServlet] en el contexto con ruta [/GoodProject] lanzó la excepción [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.duckranger.goodproject.domain.Tramp.id; nested exception is javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.duckranger.goodproject.domain.Tramp.id] con causa raíz
    java.lang.IllegalArgumentException: Can not set java.lang.Long field com.duckranger.goodproject.domain.Tramp.id to org.hibernate.id.IdentifierGeneratorHelper$2

    This is the method Controller:

    @RequestMapping(value = "/tramps", method = RequestMethod.POST, params="po4")
    public String saveJPA(Model model, HttpServletRequest request) {
    logger.info("Saving... Tramp in JPA");
    Tramp tramp = new Tramp();
    tramp.setName(request.getParameter("name"));
    tramp.setDistance(12.4);
    tramp.setDifficulty(null);
    //model.addAttribute("tramps", trampsService.save(tramp));
    tramp = trampsService.save(tramp);
    return "tramps/add";
    }

    Which is the problem?

    Thank you very much for your help

  • #2
    Hey!

    I moved this over to the web forum since it doesn't seem to be related to the development environment itself.

    HTH,
    Martin

    Comment

    Working...
    X