Hi,
I’m trying to edit a one-to-one relationship on the same screen. What I have mostly seems to work fine.
I have a datasource setup like this.
<dsContext>
<datasource id="matterDs"
class="com.zynde.tangmere.entity.matter.Matter"
view="matter-create-view">
<datasource id="contextDs"
property="context"/>
</datasource>
</dsContext>
I have the initNewItem setup like this.
@Override
protected void initNewItem(Matter item) {
super.initNewItem(item);
item.setContext(metadata.create(MatterContext.class));
}
So all the above works nicely when Creating a new Matter Entity and Editing a Matter Entity that has a Context Entity created.
What doesn’t work is if I go to edit a Matter entity that doesn’t have a Context entity yet. So what is the best way to create a Context Entity when there isn’t one and I’m in the Edit Action of the Owner Entity?
Thanks