/** * This method is used to override "hasIdentifierMapper" in EntityMetaModels of entities which * have composite id and class defined for it. It's workaround for bug as found in forum * https://forum.hibernate.org/viewtopic.php?t=978915&highlight= * * @param sessionFactory */ public static void fixCompositeIDHandling(SessionFactory sessionFactory) { fixCompositeIdentifierInMetaModel(sessionFactory, RObjectDeltaOperation.class); fixCompositeIdentifierInMetaModel(sessionFactory, ROExtDate.class); fixCompositeIdentifierInMetaModel(sessionFactory, ROExtString.class); fixCompositeIdentifierInMetaModel(sessionFactory, ROExtPolyString.class); fixCompositeIdentifierInMetaModel(sessionFactory, ROExtReference.class); fixCompositeIdentifierInMetaModel(sessionFactory, ROExtLong.class); fixCompositeIdentifierInMetaModel(sessionFactory, RAssignmentExtension.class); fixCompositeIdentifierInMetaModel(sessionFactory, RAExtDate.class); fixCompositeIdentifierInMetaModel(sessionFactory, RAExtString.class); fixCompositeIdentifierInMetaModel(sessionFactory, RAExtPolyString.class); fixCompositeIdentifierInMetaModel(sessionFactory, RAExtReference.class); fixCompositeIdentifierInMetaModel(sessionFactory, RAExtLong.class); fixCompositeIdentifierInMetaModel(sessionFactory, RObjectReference.class); for (RReferenceOwner owner : RReferenceOwner.values()) { fixCompositeIdentifierInMetaModel(sessionFactory, owner.getClazz()); } fixCompositeIdentifierInMetaModel(sessionFactory, RAssignmentReference.class); for (RCReferenceOwner owner : RCReferenceOwner.values()) { fixCompositeIdentifierInMetaModel(sessionFactory, owner.getClazz()); } fixCompositeIdentifierInMetaModel(sessionFactory, RAssignment.class); fixCompositeIdentifierInMetaModel(sessionFactory, RExclusion.class); fixCompositeIdentifierInMetaModel(sessionFactory, RTrigger.class); for (RObjectType type : ClassMapper.getKnownTypes()) { fixCompositeIdentifierInMetaModel(sessionFactory, type.getClazz()); } }
public static RObjectReference jaxbRefToRepo( ObjectReferenceType reference, PrismContext prismContext, RObject owner, RReferenceOwner refOwner) { if (reference == null) { return null; } Validate.notNull(owner, "Owner of reference must not be null."); Validate.notNull(refOwner, "Reference owner of reference must not be null."); Validate.notEmpty(reference.getOid(), "Target oid reference must not be null."); RObjectReference repoRef = RReferenceOwner.createObjectReference(refOwner); repoRef.setOwner(owner); RObjectReference.copyFromJAXB(reference, repoRef, prismContext); return repoRef; }