Skip to content

Relationship Management

CrudCraft generates helper classes to keep bidirectional associations in sync.

RelationshipMeta

For each entity a RelationshipMeta class is generated. It knows how to link parent and child objects based on your JPA mappings.

Using the Helper

The generated services call the helper before persisting or deleting entities. When overriding save logic, invoke the appropriate link or unlink methods to maintain relationships.

java
relationshipMeta.link(user, requestDto);

Tips

  • Use the helpers in custom code to avoid stale references.
  • RelationshipMeta methods are idempotent and safe to call multiple times.