Hi,

Can someone help me understand something?

I’m trying to model a one-to-one relationship between two entities but I can’t 
seem to get the relationship to be optional.

In my specific case I need to model an entity representing shipments with a 
postal service. Each shipment needs to have a number taken from a range/group 
that is pre-assigned by the postal service.

Thus I created a SHIPMENT_NUMBER entity with just an INTEGER attribute and then 
used that attribute to build the relationship with the SHIPMENT entity. 
Possibly with “To dep PK” as well.

I want the relationship to be optional so that I can generate SHIPMENT_NUMBER 
as many as I want and populate them with the numbers assigned by the postal 
service and only later, when the real SHIPMENT is actually needed/created, link 
it with the number in a one-to-one fashion.

I’m not sure why, but my class generated content always shows the relationship 
as mandatory.

Coming from the WebObjects world, I'm used to a modeler that explicitly shows 
checkboxes for isMandatory on relationships like with the attributes. Here in 
Cayenne it seems that optionality is implicitly determined based on the design.

Have I misunderstood something? Is my design flawed?

Any tip is appreciated.

Regards,
Riccardo

Reply via email to