Access JPA <persistence-unit-metadata> programmatically
After debugging for a while I found a solution to access the schema of an entity.
EntityType<MyEntity> entity = emf.getMetamodel().entity(MyEntity.class);
EntityTypeImpl entityTypeImpl = (EntityTypeImpl) entity;
ClassDescriptor descriptor = entityTypeImpl.getDescriptor();
String schema = descriptor.getDefaultTable().getTableQualifier();
Looking for an easier and better way to access the information! Thank you so much.