jpacontainer add manytomany relation

hi,

i’m using jpa-container for a little recipe program.

so i have a recipe entity and recipesubgroupentities with a manytomany relation between them.

In a fieldgroup i edit the recipe. now i want to add a recipe subgroup to the recipe. but the relation isn’t persistet.

the code looks like this:

Item itemDataSource = recipeFieldGroup.getItemDataSource();
EntityItem item = recipeContainer.getItem(Long.parseLong(itemDataSource.getItemProperty(“id”).toString()));
Recipe recipe = item.getEntity();

recipe.getRecipeSubGroups().add(newRecipeSubGroup);

try {
recipeFieldGroup.commit();
} catch (CommitException e) {
e.printStackTrace();
}

can someone give me a hint?

Are you set Cacade for property in entity class:

    @OneToMany( cascade = CascadeType.ALL, orphanRemoval = true )
    private List< SubEntity > property1;

thank you!
works fine!