Associations

Associations are used to manifest links between classes in the persistence model. The mapping rules applied to an association vary according to the cardinality of the association, its aspect (unidirectional or bidirectional) and the type of SQL mapping chosen.

Modifying the cardinality of an association

An association has two roles, one at each of its extremities. The cardinality of an association depends on the cardinality of these two roles.

To modify the cardinality of a role:

  • Select the association and position yourself on the SQL tab.

  • Open the properties page associated with the role you want to modify.

  • Modify the cardinality of the role.

Relationship between the cardinality of roles and the cardinality of the association
Role 1 Role 2 Association

0..1

0..1

One To One

1..1

1..1

One To One

Not Null

0..1

0..*

One To Many

1..1

1..*

One To Many

Not Null

0..*

0..1

Many To One

1..*

1..1

Many To One

Not Null

0..*

0..*

Many To Many

1..*

1..*

Many To Many

Defining foreign key names

According to the type of mapping chosen for the association, the names of the foreign keys used in the SQL model must be configured.

To modify the names of foreign keys:

  • Select the association and position yourself on the SQL tab.

  • Select the properties page associated with the role that you want to modify.

  • You will then be able to use the Foreign-Key : identifiername property for each expected foreign key.

image
Defining the name of a foreign key
Defining the name of the join table

If you choose to map an association to a join table at SQL model level, the name of the join table is defined in the following way: * If the "Persistent Name" property of the association is defined, the join table will be named after this property. * If this is not the case, the join table will be named from the name of the association.

Types supported at conceptual level

The SQL Designer module currently supports the following types for identifiers and properties:

  • Char

  • Float

  • Int

  • Byte

  • Short

  • Long

  • Double

  • java.lang.String

  • java.lang.Class

  • java.lang.Boolean

  • java.lang.Char

  • java.lang.Double

  • java.lang.Float

  • java.lang.Number

  • java.lang.Integer

  • java.lang.Long

  • java.lang.Character

  • java.sql.Clob

  • java.sql.Blob

  • java.util.TimeZone

  • java.util.Calendar

  • java.util.Currency

  • java.util.Date

The SQL Designer module currently supports the following types of collections (defined at association role level):

  • array –> []

  • bag –> java.util.Collection

  • bag –> java.util.List

  • list –> java.util.List

  • map –> java.util.Map

  • map –> java.util.SortedMap

  • set –> java.util.Set

  • set –> java.util.SortSet