Is it possible to have a non-persistent entity have a 1-1 association to a persistent entity
Currently a non-persistent Entity seems to only be able to have a *-1 association to a persistant Entity: I have several usecases for a non-persistent entity to have a 1-1 relation to a persistent entity. Logically I see no reason for this not to be allowed. Nevertheless it seems to be not possible. If I set the association in the non-persistent entity to 1-1 (Type: ‘Reference’, Owner: ‘Both’), the Modeler says that the association has to have Owner ‘Default’, resulting in a *-1 association. Am I missing something? Is it realy not possible to have a non-persistent entity have a 1-1 association to a persistent entity? If so, is the a reason for this?
Tim v Steenbergen
It's not possible. Not entirely sure about the reasoning, other than from a logical/database point of view (which would be weird, considering NPE's aren't in the database) you could argue that there could always be * NPE's connected as each session would be able to create their own without other sessions knowing of it's existence. Solving this within a single session is easy by doing a retrieve over association before doing a create action. Retrieve = empty? Do create. Not empty? Either delete+create or change, depending on the use case.