title: @OneToMany @JoinTable usage with three tables
body: <p>I have been stuck with one scenario in hibernate, i tried looking for such scenario discussion but i couldnt get so raing here for any suggestions or help,</p>
  
  <p>i have three tables category , category_artical, artical.</p>
  
  <pre><code>CREATE TABLE `category` (
    `category_id` int(11) NOT NULL AUTO_INCREMENT,
    `category_name` varchar(45) NOT NULL,
    `category_description` varchar(45) NOT NULL,
    PRIMARY KEY (`category_id`)
  );
  
  
  CREATE TABLE `article` (
    `article_id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(70) NOT NULL,
    `description` varchar(250) NOT NULL,
    `keywords` varchar(150) NOT NULL,
    `content` text NOT NULL,
    PRIMARY KEY (`article_id`)
  );
  
  CREATE TABLE `category_article` (
    `category_id` int(11) NOT NULL,
    `article_id` int(11) NOT NULL,
    'category_article_status' varchar(1) NOT NULL.
    'category_article_type' varchar(2) NOT NULL,
    PRIMARY KEY (`category_id`,`article_id`),
    UNIQUE KEY `article_id_UNIQUE` (`article_id`),
    KEY `fk_category` (`category_id`),
    KEY `fk_article` (`article_id`),
    CONSTRAINT `fk_article` FOREIGN KEY (`article_id`) REFERENCES `article` (`article_id`),
    CONSTRAINT `fk_category` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`)
  );
  </code></pre>
  
  <p>i have entity for category,</p>
  
  <pre><code>    @Entity
      @Table(name = "CATEGORY")
      public class Category {
  
          private long id;
          private String name;
  
      @Id
      @GeneratedValue
      @Column(name = "CATEGORY_ID")
      public long getId() {
          return id;
      }
  
      @OneToMany(cascade = CascadeType.ALL)
      @JoinTable(
              name = "CATEGORY_ARTICLE",`enter code here`
              joinColumns = @JoinColumn(name = "CATEGORY_ID"),
              inverseJoinColumns = @JoinColumn(name = "ARTICLE_ID")
      )
      private Set&lt;Article&gt; articles; 
      // other getters and setters...
  
  /*For Article entity is */
      @Entity
      @Table(name = "ARTICLE")
      public class Article {
          private long id;
          private String title;
          private String description;
          private String keywords;
          private String content;
  
      @Id
      @GeneratedValue
      @Column(name = "ARTICLE_ID")
      public long getId() {
          return id;
      }
  
      // other getters and setters...
  </code></pre>
  
  <p>For category_article i have no entity as i am using @jointable in category
  So everything work fine till i have only two column in category_article which are category_id and article_id. But as soon as i added two more columns i am confused how to inser data in those coulmns(category_article_status and category_article_type) which are not null.</p>
  
  <p>any suggestions on this.</p>