isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Cameron <steve.cameron...@gmail.com>
Subject Re: Wrong behavior when I set the parent on the child, in an 1:m assoc
Date Tue, 14 Mar 2017 20:34:56 GMT
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 <eder2007np@gmail.com> 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;
>
>                                "
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message