It should be done as a many-to-many relationship. (one Operator has many Skills and one Skill has many Operators).
So you'd need a join table. The datanucleus documentation explains how with a @Join and an @Order annotation. To make your code work you'd need to create a new Skill entity each time, which is not what you want to do I assume. On Wed, Mar 15, 2017 at 2:58 AM, L Eder <[email protected]> wrote: > Hi members: > > I have a Skills entity that has two instances. > And i have Operador as its parent, and I created two instances of it. > > I then add skill1 to operador1. However when I add skill1 to operador2, > then skill1 is moved to operador2 from operator1. > > I would like both operador instances has both skill1. > > I even tried this, without success: > public Operador add( > > @ParameterLayout(named="Habilidade a Adicionar") final Skill > skill){ > > getSkilldeveloped().add(skill); > > > > return this; > > } > > Any tips? Thanks in advance, > > Source code > " > -Operador.java- > > > @Persistent(mappedBy = "operador", dependentElement = "true") > > @CollectionLayout(render = > RenderType.EAGERLY) > > @Getter @Setter > > private SortedSet<Skill> skilldeveloped > = new TreeSet<Skill>(); > > > > @Action(semantics = > SemanticsOf.IDEMPOTENT) > > public Operador add( > > > @ParameterLayout(named="Habilidade a Adicionar") final Skill skill){ > > > > skill.setOperador(this); > > > > return this; > > } > > > > -Skill.java- > > > > @Column(allowsNull = "true") > > @Getter @Setter > > private Operador operador; > > " >
