Search in sources :

Example 1 with NamedAttributeNode

use of jakarta.persistence.NamedAttributeNode in project hibernate-orm by hibernate.

the class JpaMetamodelImpl method applyNamedAttributeNodes.

private void applyNamedAttributeNodes(NamedAttributeNode[] namedAttributeNodes, NamedEntityGraph namedEntityGraph, GraphImplementor<?> graphNode) {
    for (NamedAttributeNode namedAttributeNode : namedAttributeNodes) {
        final String value = namedAttributeNode.value();
        AttributeNodeImplementor<?> attributeNode = graphNode.addAttributeNode(value);
        if (StringHelper.isNotEmpty(namedAttributeNode.subgraph())) {
            final SubGraphImplementor<?> subgraph = attributeNode.makeSubGraph();
            applyNamedSubgraphs(namedEntityGraph, namedAttributeNode.subgraph(), subgraph);
        }
        if (StringHelper.isNotEmpty(namedAttributeNode.keySubgraph())) {
            final SubGraphImplementor<?> subgraph = attributeNode.makeKeySubGraph();
            applyNamedSubgraphs(namedEntityGraph, namedAttributeNode.keySubgraph(), subgraph);
        }
    }
}
Also used : NamedAttributeNode(jakarta.persistence.NamedAttributeNode)

Example 2 with NamedAttributeNode

use of jakarta.persistence.NamedAttributeNode in project hibernate-orm by hibernate.

the class JPAXMLOverriddenAnnotationReader method bindNamedAttributeNodes.

private static void bindNamedAttributeNodes(List<JaxbNamedAttributeNode> elements, AnnotationDescriptor ann) {
    List<NamedAttributeNode> annNamedAttributeNodes = new ArrayList<>();
    for (JaxbNamedAttributeNode element : elements) {
        AnnotationDescriptor annNamedAttributeNode = new AnnotationDescriptor(NamedAttributeNode.class);
        copyAttribute(annNamedAttributeNode, "value", "name", element.getName(), true);
        copyAttribute(annNamedAttributeNode, "subgraph", element.getSubgraph(), false);
        copyAttribute(annNamedAttributeNode, "key-subgraph", element.getKeySubgraph(), false);
        annNamedAttributeNodes.add(AnnotationFactory.create(annNamedAttributeNode));
    }
    ann.setValue("attributeNodes", annNamedAttributeNodes.toArray(new NamedAttributeNode[annNamedAttributeNodes.size()]));
}
Also used : AnnotationDescriptor(org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor) ArrayList(java.util.ArrayList) JaxbNamedAttributeNode(org.hibernate.boot.jaxb.mapping.spi.JaxbNamedAttributeNode) NamedAttributeNode(jakarta.persistence.NamedAttributeNode) JaxbNamedAttributeNode(org.hibernate.boot.jaxb.mapping.spi.JaxbNamedAttributeNode)

Aggregations

NamedAttributeNode (jakarta.persistence.NamedAttributeNode)2 ArrayList (java.util.ArrayList)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 JaxbNamedAttributeNode (org.hibernate.boot.jaxb.mapping.spi.JaxbNamedAttributeNode)1