My simplified model looks like this:
@Entity public class Aspect extends Model {
@Id public Long id;
@OneToMany(cascade = CascadeType.ALL) public List<Restriction> restrictions;
}
@Entity public class Restriction extends Model {
@Id public Integer id;
@ManyToOne public RestrictionTemplate restrictionTemplate;
}
@Entity public class RestrictionTemplate extends Model {
@Id private Integer id;
}
Basically the idea is this: each Aspect has a set of Restrictions. And each Restriction itself relies on a RestrictionTemplate.
I want Aspect creation form to like this: user can select some RestrictionTemplates and on form submit new Restrictions should be created and associated with new Aspect.
Let me explain once again: On form submission I want to create Aspect and relating Restrictions based on RestrictionTemplate's ids provided.
Whicn names should the fields in the form have in order to make such binding possible?
The naming which works for direct relantionships:
restrictions[0].restrictionTemplate.id
restrictions[1].restrictionTemplate.id
doesn't work here (creates Aspect entry in DB, but no Restriction entries).