Faker Doesn't Know Your Entities Are Related, So I Built Something That Does
Faker Doesn't Know Your Entities Are Related, So I Built Something That Does You've added a second entity to the schema, wired up a @ManyToOne , and gone back to your seed script to generate fifty more rows. Ninety seconds later, the app refuses to start: unique constraint violation, somewhere inside a loop you wrote three weeks ago at 11pm. You fix it. You restart. A different field breaks a different constraint. This is the exact moment every Spring Boot developer eventually meets the real limit of tools like Faker. They're brilliant at generating a name, an email, an address. They have no idea the Payment sitting in front of them needs a Counterparty to already exist. So you do what everyone does: hand-write the wiring. Create parents first. Hold onto their generated IDs. Wire them into children. Hope you didn't just violate a @NotNull somewhere in the process. It works, for a while. Then the schema changes, and the script quietly stops matching reality until the next 3am debugging session finds out the hard way. I hit this enough times that I stopped patching the script and looked at the actual problem: the information needed to seed this correctly already exists. It's sitting right there in the entity, in the annotations you already wrote. @ManyToOne , @NotNull , @Column(unique = true) , JPA already knows the shape of your data. Nothing should need to be told that twice. That became SynthForge . The core idea Instead of writing a script that generates data, you annotate the entity: @Entity @Seed ( count = 50 ) public class Counterparty { /* fields only */ } @Entity @Seed ( count = 200 ) public class Payment { @ManyToOne ( optional = false ) private Counterparty counterparty ; } Start the app in a dev profile. Both tables populate, correctly ordered, on every restart. No seed method. No calling code, anywhere. The entity is the seed script. What's actually happening underneath Entity scanning. SynthForge reads JPA-managed attributes through the jakarta.persisten