Faker Doesn't Know Your Entities Are Related, So I Built Something That Does
Описание и применение
SynthForge автоматически генерирует данные для JPA‑сущностей, учитывая связи и ограничения, устраняя необходимость ручных скриптов seed‑данных.
Задача
Spring Boot developers struggle to seed relational data with Faker because it ignores entity relationships, leading to unique constraint violations and fragile seed scripts.
Результат
Automated, idempotent data seeding that respects entity relationships and constraints, reducing debugging time and improving developer productivity.
Рабочий процесс
- Annotate entities with @Seed(count=…)
- Add JPA relationship annotations (@ManyToOne, @NotNull, @Column(unique=true))
- Add SynthForge dependency to Maven
- Enable SynthForge profile on startup
- Run the application – tables populate automatically
Доказательства
Start the app in a dev profile. Both tables populate, correctly ordered, on every restart.
From the owning-side @ManyToOne/@OneToOne relationships, it builds a dependency graph and topologically sorts it.
- Дата записи: 2026-09-14T19:00:49.169Z