EntityManagerFactoryImpl implements EntityManagerFactory, PersistenceUnitUtil { @Override public Object getIdentifier(Object entity) { Objects.requireNonNull(entity); final EntityType<?> et = getMetamodel().entity(entity.getClass()); return EntityPropertiesUtils.getFieldValue(et.getIdentifier().getJavaField(), entity); } EntityManagerFactoryImpl(final Map<String, String> properties); @Override void close(); @Override EntityManager createEntityManager(); @Override EntityManager createEntityManager(Map<String, String> map); ServerSession getServerSession(); @Override boolean isOpen(); @Override Map<String, String> getProperties(); @Override Metamodel getMetamodel(); @Override PersistenceUnitUtil getPersistenceUnitUtil(); @Override void addNamedQuery(String name, Query query); @Override T unwrap(Class<T> cls); @Override Object getIdentifier(Object entity); @Override boolean isLoaded(Object entity, String attributeName); @Override boolean isLoaded(Object entity); @Override Cache getCache();  }
@Test void getIdentifiersExtractsEntityIdentifier() { final OWLClassA instance = Generators.generateOwlClassAInstance(); assertEquals(instance.getUri(), emf.getIdentifier(instance)); }