kuros / random-jpa

Create random test data for JPA/Hibernate entities.
GNU General Public License v3.0
26 stars 4 forks source link

Primary table should be loaded if foreign key Id provided #27

Closed kuros closed 6 years ago

kuros commented 6 years ago

Let us say we have a link, Link.newLink(Pizza.cheeseId, Cheese.id), so Pizza has a foreign key to Cheese.

Now if I say jpaContext.createAndPersist(Entity.of(Pizza.class).with(Pizza_.cheeseId, 123)), it should load existing Cheese Entity with id 123. and not try create another Cheese.

kuros commented 6 years ago

Fixed the issue, also improved in performance & data generation design.