private <V extends IdentityType> IdentityType lookupIdentityTypeById(IdentityContext context, Class<V> type, String identifier) { EntityManager entityManager = getEntityManager(context); if (IdentityType.class.equals(type)) { // when querying based on the IdentityType base type, we try to load the instance from all available mappers. for (EntityMapper entityMapper : getEntityMappers()) { if (entityMapper.getMappingsFor(type) != null && entityMapper.isRoot()) { Object entity = entityManager.find(entityMapper.getEntityType(), identifier); V identityType = entityMapper.<V>createType(entity, entityManager); if (identityType != null) { return identityType; } } } } else { // we know the right type, we just lookup based on its root mapper Object entity = entityManager.find(getRootMapper(type).getEntityType(), identifier); if (entity != null) { return getRootMapperForEntity(entity.getClass()).<V>createType(entity, entityManager); } } return null; }
private <V extends IdentityType> IdentityType lookupIdentityTypeById(IdentityContext context, Class<V> type, String identifier) { EntityManager entityManager = getEntityManager(context); if (IdentityType.class.equals(type)) { // when querying based on the IdentityType base type, we try to load the instance from all available mappers. for (EntityMapper entityMapper : getEntityMappers()) { if (entityMapper.getMappingsFor(type) != null && entityMapper.isRoot()) { Object entity = entityManager.find(entityMapper.getEntityType(), identifier); V identityType = entityMapper.<V>createType(entity, entityManager); if (identityType != null) { return identityType; } } } } else { // we know the right type, we just lookup based on its root mapper Object entity = entityManager.find(getRootMapper(type).getEntityType(), identifier); if (entity != null) { return getRootMapperForEntity(entity.getClass()).<V>createType(entity, entityManager); } } return null; }
reference.addIdentityTypeReference(descriptor, identityTypeEntity.toString()); } else { EntityMapper entityMapper = getRootMapperForEntity(identityTypeEntity.getClass());
reference.addIdentityTypeReference(descriptor, identityTypeEntity.toString()); } else { EntityMapper entityMapper = getRootMapperForEntity(identityTypeEntity.getClass());