How to create a relationship from non primary key column?

In entity relationship diagram, suppose there are 2 entities:

user (primary key: userId)

event (eventId has been specified as the ONLY primary key column, there is a non primary key and nullable column: userId) userId. userId relates to user entity’s userId

I would like to create a zero to one relationship (event.userId may or may not relate to one user.userId).

I highlight the One-to-One Relationship (I’d like to drag a Zero-to-One Relationship but it is not available in the Entity Relationship Category) and drag from event entity to user entity. The relationship is created but in the relationship’s Foreign Key Column Mapping, Primary Key (Event) is not editable. It must be eventId. How can I change it to userId?

Thanks, billy

Hi Billy,

Thanks for your post. For referencing userId in user entity, this will be available in our coming release, VP Suite 3.4 which will be available within 2 months.
In VP Suite 3.4, when you have set “userId” as Unique Key in the event entity, then you will be able to reference it to userId in the user entity.
Once VP Suite 3.4 is released, I’ll let you know immediately.

For Zero-to-One Relationship, you need to draw the One-to-One Relationship first, then open the specification of the connector and select “Zero or One” in Cardinality (see attached image).

If there is any further inquiry, please do not hesitate to contact me.

Best regards,
Lilian Wong
select_zero_in_cardinality.png

Wait, did I read this correctly? You will be supporting the use of Foreign Keys referencing a Parent Key which is not a Primary Key, but is instead references a Unique Key.

If that is true, will that be supported through Hibernate implementations, as well?

The user should be able to select the key from the parent if there is more than one.

Thanks, Gregg

Lillian,

Am I reading your response correctly? It sounds like you will be supporting the selection of a Unique Key as the parent key in a foreign key reference.

This capability is a major gap in the current product. Currently, only a Primary Key can be the parent key.

Also, is that supported in the Hibernate implementations, as well?

Anxiously awaiting,
Gregg

Hi Gregg,

Thanks for your post. Yes, we support Foreign Key referencing a Unique Key as parent key., and this will be support in Hibernate implementations (ORM features).

Once VP Suite 3.4 is released, I’ll have a post here immediately.

Best regards,
Lilian Wong

Hi Billy and Gregg,

I’m sorry for my late notification about VP Suite 3.4 release (and we released VP Suite 3.4 SP1 recently). Since VP Suite 3.4, you are able to select unique key as parent key in a foreign key reference, please refer to the flash movie for detailed steps:
http://files2.visual-paradigm.com/FlashDemo/DB/reference_unique_key.htm

If there is any further inquiry, please let me know. Happy New Year!

Best regards,
Lilian Wong