title: Spring MVC + Hibernate: id to load is required for loading
body: <p>This is such a noob question, I know and I apologize. I'm trying to edit existing record with Hibernates session.merge() method and I get the following error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: id to load is required for loading
  </code></pre>
  
  <p>This is my object:</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = IDENTITY)
  @Column(name = "TITLE_ID", unique = true, nullable = false)
  private Integer titleId;
  
  @NotNull
  @NotBlank
  @Column(name = "TITLE_DESCRIPTION", nullable = false, length = 10)
  private String titleDescription;
  // default constructor, getters &amp; setters
  </code></pre>
  
  <p>This is service layer method:</p>
  
  <pre><code> public void edit(Title title) {
       logger.debug("Editing existing title");
  
       // Retrieve session from Hibernate
       Session session = sessionFactory.getCurrentSession();
  
       // Retrieve existing title via id
       Title existingTitle = (Title) session.get(Title.class, title.getTitleId());
  
       // Assign updated values to this title
       existingTitle.setTitleDescription(title.getTitleDescription());
  
       // Save updates
       session.merge(existingTitle);
   }
  </code></pre>
  
  <p>This is controller POST method:</p>
  
  <pre><code>@RequestMapping(value="/edit", method = RequestMethod.POST)
  public String postEditTitle(@Valid @ModelAttribute("titleAttribute") Title title,
                          BindingResult result) {
  
      logger.debug("Received request to edit title");
  
      if (result.hasErrors()) {
          return "editTitle";
      }
      else {
          titleService.edit(title);
          return "redirect:/essays/main/title";
      }
  }
  </code></pre>
  
  <p>What am I missing? Any help will be much appreciated.</p>