0 Replies Latest reply on Oct 26, 2005 10:47 AM by majohnst

    Map of Non-Entities

    majohnst

      I am trying to figure out the annotations for a map of basic java types:

      Map<String, Set<String>> keywords
      


      I solved a similar problem for just a Set, but I cannot figure out how to include a Map now. For the Set, I used:
      Set<String> keywords
      
      @OneToMany(cascade=CascadeType.ALL)
       @Column(name="keyword")
       @JoinTable(table=@Table(name="recipe_keywords"),
       joinColumns=@JoinColumn(name="id_recipe"))
       public Set<String> getKeywords() {
       return keywords;
       }
      


      I would like to have two tables. One for my main recipe object and one for all the recipe keywords. The recipe keyword table would be:

      recipe_keywords
      -- id_recipe
      -- map_key
      -- keyword