title: Hibernate and Spring: value of many-to-many not inserted into generated table
body: <p>I've got a bit of experience with spring, but I'm completely new to Hibernate, especially in combination with Spring:
  I want to have a Many-to-Many relationship between two tables (author, publication). The table is generated, but nothing is inserted...</p>
  
  <p>Part of Author.java:</p>
  
  <pre><code>@ManyToMany(cascade = {CascadeType.ALL})
  @JoinTable(name = "writes", joinColumns = {@JoinColumn(name = "authorId")}, inverseJoinColumns = {@JoinColumn(name = "publicationId")})
  private Set&lt;Publication&gt; publications = new HashSet&lt;Publication&gt;();
  </code></pre>
  
  <p>part of Publication.java:</p>
  
  <pre><code>@ManyToMany(mappedBy = "publications")
  private Set&lt;Author&gt; authors = new HashSet&lt;Author&gt;();
  </code></pre>
  
  <p>Is there something I forgot? </p>
  
  <p>Thanks!!!!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>here's the code which should save everything to my database:</p>
  
  <pre><code>@RequestMapping(value = PATHELEM + "/insertTest", method = RequestMethod.POST)
  public String addAuthor(@ModelAttribute("object") DatabaseObject object,
          BindingResult result) {
      authorService.addAuthor(object.getAuthor());
      publicationService.addPublication(object.getPublication());
      return PATHELEM + "/insertEntryForm";
  }
  </code></pre>