/** * Obtenir les association de premier niveau. * * @return la liste de toutes les associations. */ protected List<Attribute<? super E, ?>> getAssociations() { initialiseMetaModel(); List<Attribute<? super E, ?>> associations = new ArrayList<Attribute<? super E, ?>>(); EntityType<E> typeEntite = metaModele.entity(classeEntite); for (Attribute<? super E, ?> attribut : typeEntite.getAttributes()) { if (isAssociation(attribut.getJavaType())) { associations.add(attribut); } } return associations; }
@SuppressWarnings("unchecked") private void applyNamedEntityGraphs(Collection<NamedEntityGraphDefinition> namedEntityGraphs) { for (NamedEntityGraphDefinition definition : namedEntityGraphs) { final EntityType entityType = metamodel.getEntityTypeByName(definition.getJpaEntityName()); final EntityGraphImpl entityGraph = new EntityGraphImpl(definition.getRegisteredName(), entityType, this); final NamedEntityGraph namedEntityGraph = definition.getAnnotation(); if (namedEntityGraph.includeAllAttributes()) { for (Object attributeObject : entityType.getAttributes()) { entityGraph.addAttributeNodes((Attribute) attributeObject); } } if (namedEntityGraph.attributeNodes() != null) { applyNamedAttributeNodes(namedEntityGraph.attributeNodes(), namedEntityGraph, entityGraph); } entityGraphs.put(definition.getRegisteredName(), entityGraph); } }