btc-ag / redg

The RedG test data generation library
https://btc-ag.github.io/redg/
Apache License 2.0
10 stars 0 forks source link

JPA meta-model analysis without persistence unit name #26

Open Zemke opened 6 years ago

Zemke commented 6 years ago

Spring Boot for instance doesn't use traditional persistence unit anymore.

olewehrmeyer commented 6 years ago

While I have not tested it yet, it appears that you can simply inject the EntityManager and then use new JpaMetamodelRedGProvider(entityManager.getMetamodel()) instead of the "traditional" approach using JpaMetamodelRedGProvider.fromPersistenceUnit("name-of-unit"). I'm going to setup a test Spring project to confirm this the next few days, but according to multiple sources this should work just fine.