Hello all,
is it possible to specify a foreign key constraint for a column of type Long (using Annotations or in general, without using @Column.columnDefinition)?
The concrete Example:
I have the classes Company and Role.
Normally, the Role would have a ManyToOne association to a Company.
But, because of design decisions, we do not want to directly tie the Role to the Company.
Instead, the Role has a property companyId, that references the id of the Company.
Although, the Role.companyId shall lead to a foreign key constraint when the database schema is generated (using hbm2ddl).
We're using hibernate annotations, and there exists the feature @Column.columnDefinition.
By using this, we lose database independency, e.g. the columnDefinition must include the definition of the data type. So we do not really want to use this feature.
Do you know another possibility to specify the logical foreign key constraint?
Thanx in advance,
cheers,
Martin
|