Embedded NamedAttributeNode not supported in NamedEntityGraph

Description

I'm trying to deploy an app to Wildfly 8.1.0 (Hibernate 4.3.5), but Hibernate AttributeNodeImpl is throwing an exception - "Attribute x is not a managed type". I looked at the code and it's checking for Basic or Embedded annotation on lines 123-128 and throwing an exception if found.

My attribute is Embedded. According to JPA spec, Entity, MappedSuperclass and Embeddable are all managed types. Also, online resources and the book "Pro JPA 2" provide examples of Entity Graphs with Embedded attribute nodes.

I've attached two classes which should reproduce the issue.

Environment

Wildfly 8.1.0

Activity

Show:
Stefan Penndorf
November 24, 2016, 12:48 PM

Problem can be verified/reproduced with Hibernate 5.0.9 - I don't have permission to update the ticket and include the affected version.

Balázs Bakai
January 15, 2017, 10:34 AM

Hi!

This problem is still alive with wildfly-10.1.0.Final + hibernate 5.0.10.Final version. Do you have any near future plan to solve this? Thanks so much!

Steve Ebersole
January 15, 2017, 3:23 PM

I personally will not be tackling this until 6.0.

Attitude is one thing that will absolutely not help this move along. As far as where to look... I mean there is only one place in the codebase where EntityGraphs are applied and the exception stack trace shows you a great place to start looking.

Ted Gulesserian
October 7, 2017, 5:46 PM

Adding the stackoverflow reference here. I ran into this issue today while trying to make my application more performant by using the @EntityGraph. I will add an eager fetch annotation in my entity for now. Hoping that eventually I will not have to do that indiscriminately.

https://stackoverflow.com/questions/27552445/jpa-subgraph-to-define-fetchtype-of-an-embedded-property

Giovanni Lovato
July 10, 2018, 11:02 AM
Edited

I'm also affected with this, trying to tune my Spring repositories with entity graphs as described by many articles. I have an entity with an `@Embedded` field, which has an `@ElementCollection` field and I'm trying to fetch the collection with a graph, e.g.

but I'm getting

Assignee

Unassigned

Reporter

John Schneider

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure