private static void fixCompositeIdentifierInMetaModel(SessionFactory sessionFactory, Class clazz) { ClassMetadata classMetadata = sessionFactory.getClassMetadata(clazz); if (classMetadata instanceof AbstractEntityPersister) { AbstractEntityPersister persister = (AbstractEntityPersister) classMetadata; EntityMetamodel model = persister.getEntityMetamodel(); IdentifierProperty identifier = model.getIdentifierProperty(); try { Field field = IdentifierProperty.class.getDeclaredField("hasIdentifierMapper"); field.setAccessible(true); field.set(identifier, true); field.setAccessible(false); } catch (Exception ex) { throw new SystemException("Attempt to fix entity meta model with hack failed, reason: " + ex.getMessage(), ex); } } }
public IdentifierProperty getIdentifierProperty() { return identifierAttribute; }
public IdentifierProperty getIdentifierProperty() { return identifierProperty; }