org.hibernate.MappingException: Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass

Hibernate JIRA | Oliver Breidenbach | 1 year ago
  1. 0

    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

    Hibernate JIRA | 1 year ago | Oliver Breidenbach
    org.hibernate.MappingException: Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass
  2. 0

    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

    Hibernate JIRA | 1 year ago | Oliver Breidenbach
    org.hibernate.MappingException: Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass
  3. 0

    org.hibernate.MappingException: Unknown entity when trying to save POJO

    Stack Overflow | 2 years ago | user3831696
    org.hibernate.MappingException: Unknown entity: org.aggu.sramam.pojo.SramaSangham
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.hibernate.MappingException: Unknown entity: com.mycompany.DeviceDetails

    Stack Overflow | 2 years ago | Siddharth
    org.hibernate.MappingException: Unknown entity: com.mycompany.backend.hibernate.DeviceDetails
  6. 0

    org.hibernate.MappingException: Unknown entity: com.mycompany.DeviceDetails

    tagwith.com | 11 months ago
    org.hibernate.MappingException: Unknown entity: com.mycompany.backend.hibernate.DeviceDetails

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.MappingException

      Unknown entity: com.example.hibernate.bugs.inherited.MappedSupperclass

      at org.hibernate.internal.SessionFactoryImpl.getEntityPersister()
    2. Hibernate
      SessionFactoryImpl.getEntityPersister
      1. org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776)
      1 frame
    3. org.hibernate.jpa
      EntityGraphImpl.addSubgraph
      1. org.hibernate.jpa.internal.metamodel.Helper.resolveAttributeSource(Helper.java:47)
      2. org.hibernate.jpa.internal.metamodel.Helper.resolveType(Helper.java:96)
      3. org.hibernate.jpa.graph.internal.AttributeNodeImpl.internalMakeSubgraph(AttributeNodeImpl.java:123)
      4. org.hibernate.jpa.graph.internal.AttributeNodeImpl.makeSubgraph(AttributeNodeImpl.java:98)
      5. org.hibernate.jpa.graph.internal.AbstractGraphNode.addSubgraph(AbstractGraphNode.java:159)
      6. org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:81)
      7. org.hibernate.jpa.graph.internal.EntityGraphImpl.addSubgraph(EntityGraphImpl.java:26)
      7 frames
    4. com.example.hibernate
      InheritedEntityGraphTest.attributeNodeInheritanceTest
      1. com.example.hibernate.bugs.inherited.InheritedEntityGraphTest.attributeNodeInheritanceTest(InheritedEntityGraphTest.java:71)
      1 frame