Try @Column(required = false).

The @Property annotation is an Isis one, not recognised by DataNucleus.

On Wed, 26 Apr 2017, 12:25 L Eder, <[email protected]> wrote:

> Hi Ahmed, i tried marking the column using this
>
>            @Property(notPersisted=true)
>
> without effect.
>
> That was the closest property atribute i found in the documentation.
>
> Is that what you meant?
> Eder
>
>
> 2017-04-25 14:59 GMT-04:00, Ahmed Ragab <[email protected]>:
> > I guess you need to mark the column as not required.
> >
> > Sorry for the short reply. Sent from phone.
> >
> > Best Regards,
> > Ahmed
> >
> > On 25 Apr 2017, 15:43 +0200, L Eder <[email protected]>, wrote:
> >> Hello members
> >>
> >> i have this use case, in that i need to extract some data from a
> >> repository object of the own entity.
> >>
> >> Let me explain:
> >> In the creation of a new entity Scenario, i have to select a past
> >> scenario, via drop-down list of Scenario repository.
> >>
> >> Then i did this: i added a reference property to itself
> >> Scenario,.java:
> >> private Scenario pastScenario;
> >>
> >> However i am getting this IDE build time error:
> >>
> >> MySQLIntegrityConstraintViolationException: Cannot add or update a
> >> child row: a foreign key constraint fails (`database`.`#sql-6c4_44c`,
> >> CONSTRAINT `scenario_fk1` FOREIGN KEY (`pastscenario_id_oid`)
> >> REFERENCES `scenario` (`id`))
> >>
> >> How could then correctly model this dependency case in Isis?
> >>
> >> Thanks for any help, Eder
> >> -------------------------------------
> >> Scenario.java
> >> "
> >> ....
> >> @Column(allowsNull = "true")
> >> @Property()
> >> @Getter @Setter
> >> private Scenario pastScenario;
> >>
> >> ...
> >>
> >> @Persistent(table="ScenarioStuffItems")
> >> @Join(column="scenario_id")
> >> @Element(column="stuffitem_id")
> >> @Getter @Setter
> >> @CollectionLayout(render = RenderType.EAGERLY, named="Stuff View")
> >> private SortedSet<StuffItem> stuffItems = new TreeSet<StuffItem>();
> >>
> >> ....
> >>
> >> public Scenario importStuff() {
> >>
> >> final SortedSet<StuffItem> stuffItemsOnPastScenario =
> >> this.getPastScenario().getStuffItems();
> >>
> >> for (StuffItem siOnPS: stuffItemsOnPastScenario){...extract some data
> >> ...}
> >>
> >> ....
> >>
> >> }
> >> "
> >>
> >> ScenarioMenu.java
> >> "
> >> @Action(
> >> )
> >> @MemberOrder(sequence = "3")
> >> public Scenario create(
> >> ...
> >> @Parameter(optionality = Optionality.OPTIONAL)
> >> @ParameterLayout(named="Past Scenario")
> >> final Scenario pastScenario,
> >> ....
> >> "
> >
>

Reply via email to