org.hibernate.MappingException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Having a mapped super class: {code:java} @MappedSuperclass public class MappedSupperclass { @OneToOne(fetch = FetchType.LAZY) public Bar bar; } {code} And extending class Foo: {code:java} @Entity public class Foo extends MappedSupperclass { } {code} Trying to add Subgraph: {code:java} EntityGraph<Foo> entityGraph = em.createEntityGraph( Foo.class ); entityGraph.addSubgraph( "bar" ); {code} Throws exception: {noformat} org.hibernate.MappingException: Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776) at org.hibernate.jpa.internal.metamodel.Helper.resolveAttributeSource(Helper.java:47) at org.hibernate.jpa.internal.metamodel.Helper.resolveType(Helper.java:96) at org.hibernate.jpa.graph.internal.AttributeNodeImpl.internalMakeSubgraph(AttributeNodeImpl.java:123) at org.hibernate.jpa.graph.internal.AttributeNodeImpl.makeSubgraph(AttributeNodeImpl.java:98) at org.hibernate.jpa.graph.internal.AbstractGraphNode.addSubgraph(AbstractGraphNode.java:159) at org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:81) at org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:26) at com.example.hibernate.bugs.inherited.InheritedEntityGraphTest.attributeNodeInheritanceTest(InheritedEntityGraphTest.java:71) {noformat} Reason: In AttributeNodeImpl,internalMakeSubgraph the declaring type of the attribute is used not the queried managed type. PR will follow
    via by Oliver Breidenbach,
  • Having a mapped super class: {code:java} @MappedSuperclass public class MappedSupperclass { @OneToOne(fetch = FetchType.LAZY) public Bar bar; } {code} And extending class Foo: {code:java} @Entity public class Foo extends MappedSupperclass { } {code} Trying to add Subgraph: {code:java} EntityGraph<Foo> entityGraph = em.createEntityGraph( Foo.class ); entityGraph.addSubgraph( "bar" ); {code} Throws exception: {noformat} org.hibernate.MappingException: Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776) at org.hibernate.jpa.internal.metamodel.Helper.resolveAttributeSource(Helper.java:47) at org.hibernate.jpa.internal.metamodel.Helper.resolveType(Helper.java:96) at org.hibernate.jpa.graph.internal.AttributeNodeImpl.internalMakeSubgraph(AttributeNodeImpl.java:123) at org.hibernate.jpa.graph.internal.AttributeNodeImpl.makeSubgraph(AttributeNodeImpl.java:98) at org.hibernate.jpa.graph.internal.AbstractGraphNode.addSubgraph(AbstractGraphNode.java:159) at org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:81) at org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:26) at com.example.hibernate.bugs.inherited.InheritedEntityGraphTest.attributeNodeInheritanceTest(InheritedEntityGraphTest.java:71) {noformat} Reason: In AttributeNodeImpl,internalMakeSubgraph the declaring type of the attribute is used not the queried managed type. PR will follow
    via by Oliver Breidenbach,
    • org.hibernate.MappingException: Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776) at org.hibernate.jpa.internal.metamodel.Helper.resolveAttributeSource(Helper.java:47) at org.hibernate.jpa.internal.metamodel.Helper.resolveType(Helper.java:96) at org.hibernate.jpa.graph.internal.AttributeNodeImpl.internalMakeSubgraph(AttributeNodeImpl.java:123) at org.hibernate.jpa.graph.internal.AttributeNodeImpl.makeSubgraph(AttributeNodeImpl.java:98) at org.hibernate.jpa.graph.internal.AbstractGraphNode.addSubgraph(AbstractGraphNode.java:159) at org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:81) at org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:26) at com.example.hibernate.bugs.inherited.InheritedEntityGraphTest.attributeNodeInheritanceTest(InheritedEntityGraphTest.java:71)

    Users with the same issue

    Unknown visitor1 times, last one,
    DoktorDoener666
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    7 more bugmates