Map<String, String> properties = (configuration != null) ? configuration.getProperties() : null;
EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnitName, properties);
// Now we can get the persistence unit's metamodel and export it to Querydsl query types.
Metamodel configuration = emf.getMetamodel();
JPADomainExporter exporter = new JPADomainExporter(namePrefix, nameSuffix, new File(targetFolder), configuration);
try {
exporter.execute();
} catch (IOException e) {
throw new RuntimeException("Error in JPADomainExporter", e);
}
}