Não é possível salvar os dados na tabela composta.

Eu tenho 3 tabelas em db
Treinamento
- training_id (pk)

perfil de usuário
- profile_id (pk)

-training_profile (tabela composta)
- training_id
- profile_id








Já registrei na tabela user_profile com profile_id = 44 e quero criar um novo registro para a tabela de treinamento, além de associar esse novo treinamento ao registro user_profile já existente, com o ID 44, mas depois que os dados da postagem são salvos na tabela de treinamento, não inserido na tabela de pesquisa user_training.
Minhas Classes de Objeto São - Classe de Treinamento

@Entity
@Table(name = "training", schema = "public")
public class Training implements java.io.Serializable {

    @Id @GeneratedValue
    @Column(name = "training_id", unique = true, nullable = false)
    private Long trainingId;


    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "trainings")
    private Set<UserProfile> userProfiles = new HashSet<UserProfile>(0);

    @Column(name = "training_subject", length = 200)
    private String trainingSubject;

    public Training() {
    }

    public Long getTrainingId() {
        return this.trainingId;
    }

    public void setTrainingId(Long trainingId) {
        this.trainingId = trainingId;
    }


    public String getTrainingSubject() {
        return this.trainingSubject;
    }

    public void setTrainingSubject(String trainingSubject) {
        this.trainingSubject = trainingSubject;
    }


    public Set<UserProfile> getUserProfiles() {
        return this.userProfiles;
    }

    public void setUserProfiles(Set<UserProfile> userProfiles) {
        this.userProfiles = userProfiles;
    }
}

Perfil de usuário

@Entity @Table (nome = "perfil_usuário", esquema = "público")
classe pública UserProfile implementa java.io.Serializable {

@Id @GeneratedValue
@Column(name = "profile_id", unique = true, nullable = false)
private Long profileId;

@Column(name = "profile_description")
private String profileDescription;

@ManyToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL })
@JoinTable(name = "user_training", schema = "public", joinColumns = {
        @JoinColumn(name = "profile_id", nullable = false, updatable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "training_id", nullable = false, updatable = false) })
private Set<Training> trainings = new HashSet<Training>(0);

public UserProfile() {
}


public String getProfileDescription() {
    return this.profileDescription;
}

public void setProfileDescription(String profileDescription) {
    this.profileDescription = profileDescription;
}


public Set<Training> getTrainings() {
    return this.trainings;
}

public void setTrainings(Set<Training> trainings) {
    this.trainings = trainings;
}

}

Meu post json via carteiro

E resposta recebo

A resposta mostra que o novo registro de treinamento foi inserido na tabela com training_id como 67 Nenhuma associação encontrada para este novo treinamento salvo.

mais uma vez, ele criou um novo registro para treinamento e não se associa ao perfil de usuário existente, eu posto curl -i -X POST -H "Tipo de conteúdo: application / json" -d "{\" trainingSubject \ ": \" Oracle \ " , \ "userProfiles \": [\ "/ userProfiles / 44 \"]} "http: // localhost: 8080 / api / treinamentos