Is it possible to reference @NamedEntityGraph in another entity's @NamedEntityGraph?

Viewed 118

I have a Holding entity where I define a @NamedEntityGraph:

@NamedEntityGraph(
    name = "Holding.all",
    attributeNodes = {
        @NamedAttributeNode(value = "deck", subgraph = "Deck.all"),
        @NamedAttributeNode(value = "account"),
    },
    subgraphs = {
        @NamedSubgraph(
            name="Deck.all", 
            attributeNodes = {
                @NamedAttributeNode("brand"), 
                @NamedAttributeNode("type"),
                @NamedAttributeNode("buildings")})
    }
)

I have another entity that has a list of holdings. I would like to define on that entity @NamedEntityGraph such that it is the same as Holding.all without having to duplicate what I define on Holding.all. Is this possible?

@NamedEntityGraph(
        name = "Account.all",
        // code to refer to Holding.all?
)
@Entity
public class Account
1 Answers

As far as I know, this is not possible. You will have to duplicate this.

Related