Feature #13967
openSupport cascade constraints
0%
Description
Session.createTables
creates the database schema of the mapped tables using the MappingInfo
.
The mapper initialization will apply the InitSchemaAction
on every mapped Dbo object.
The implementation doesn't support foreign key cascade constraints.
In C++, we can define a FK constraint such as OnDeleteCascade
on a ManyToOne
relation.
Wt::Dbo::belongsTo(a, account_, "account", Wt::Dbo::OnDeleteCascade);
We can define the same constraint in Java using:
@ManyToOne(cascade = CascadeType.REMOVE)
private EntityReference<Account> account;
However, this cascade constraint won't be created in the database schema.
We should extend the implementation to ensure that cascade properties in these annotations are correctly stored in the FieldInfo
of the MappingInfo
object.
We should ensure that cascade annotations work for OneToOne, OneToMany and ManyToOne relations, i.e. creating the tables should generate the correct constraints.
Updated by Marnik Roosen 4 days ago
- Subject changed from Support cascade constraints for many-to-one relations to Support cascade constraints
- Description updated (diff)
- Status changed from InProgress to Review
- Assignee deleted (
Marnik Roosen)