protected Object lookupRelationshipType(IdentityObjectRelationshipType relationshipType, EntityManager em) {
Property<?> relationshipTypeNameProp = modelProperties.get(PROPERTY_RELATIONSHIP_TYPE_NAME);
if (relationshipTypeNameProp != null) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<?> criteria = builder.createQuery(relationshipTypeNameProp.getDeclaringClass());
Root<?> root = criteria.from(relationshipTypeNameProp.getDeclaringClass());
List<Predicate> predicates = new ArrayList<Predicate>();
predicates.add(builder.equal(root.get(relationshipTypeNameProp.getName()), relationshipType.getName()));
criteria.where(predicates.toArray(new Predicate[predicates.size()]));