I have CATEGORY, AD and CATEGORY\_AD table, typical many to many relationship. Somehow nothing is inserted into CATEGORY\_AD table. What am I missing?

In Category.java:

```
@ManyToMany
@JoinTable(name = "CATEGORY_AD", joinColumns = {
        @JoinColumn(name = "CATEGORY_ID", referencedColumnName = "ID") }, inverseJoinColumns = {
                @JoinColumn(name = "AD_ID", referencedColumnName = "ID") })
private List<Ad> ads;

```

In Ad.java:

```
@ManyToMany(mappedBy = "ads")
private List<Category> categories;

```

In my Service class:

```
        Category laCat = new Category();
        laCat.setId(categoryId);
        laCat.getAds().add(ad);

        ad.getCategories().add(laCat);
ad = adRepository.saveAndFlush(ad);

```