org.hibernate.MappingException: Unable to find physical table: BoatInXml

Hibernate JIRA | Stephen Chin | 1 decade ago
  1. 0

    To reproduce this scenario you must: * be running the latest code from CVS (3.1beta6 works fine) * use an AnnotationConfiguration to load both hbm.xml and annotated classes * create a one-to-many annotation mapping to the class loaded via an hbm.xml file Note: To simplify reproducing and fixing this problem, a unit test case has been attached. The result is that on the call to buildSessionFactory, hibernate will fall into an infinite loop in the Mappings.getLogicalColumnName class (note that this class resides in the hibernate proper project, not the hibernate annotations project). If you modify the loop to properly terminate when description comes back as null, you will then get the following exception: org.hibernate.MappingException: Unable to find physical table: BoatInXml at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:476) at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:523) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:729) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:410) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:371) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1030) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:227) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145) at org.hibernate.test.annotations.ConfigurationTest.testAnnReferencesHbm(ConfigurationTest.java:142) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86) The simplest fix I could come up with was to return the physicalName in the case where no logicalName can be found. However, I don't know enough about this code to understand the implications of this change. I've attached a modified version of the Mappings.java file that seems to fix this problem, but may introduce other issues.

    Hibernate JIRA | 1 decade ago | Stephen Chin
    org.hibernate.MappingException: Unable to find physical table: BoatInXml
  2. 0

    To reproduce this scenario you must: * be running the latest code from CVS (3.1beta6 works fine) * use an AnnotationConfiguration to load both hbm.xml and annotated classes * create a one-to-many annotation mapping to the class loaded via an hbm.xml file Note: To simplify reproducing and fixing this problem, a unit test case has been attached. The result is that on the call to buildSessionFactory, hibernate will fall into an infinite loop in the Mappings.getLogicalColumnName class (note that this class resides in the hibernate proper project, not the hibernate annotations project). If you modify the loop to properly terminate when description comes back as null, you will then get the following exception: org.hibernate.MappingException: Unable to find physical table: BoatInXml at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:476) at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:523) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:729) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:410) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:371) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1030) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:227) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145) at org.hibernate.test.annotations.ConfigurationTest.testAnnReferencesHbm(ConfigurationTest.java:142) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86) The simplest fix I could come up with was to return the physicalName in the case where no logicalName can be found. However, I don't know enough about this code to understand the implications of this change. I've attached a modified version of the Mappings.java file that seems to fix this problem, but may introduce other issues.

    Hibernate JIRA | 1 decade ago | Stephen Chin
    org.hibernate.MappingException: Unable to find physical table: BoatInXml
  3. 0

    Hibernate mapping. Table related with other two

    Stack Overflow | 1 year ago | Rob
    org.hibernate.MappingException: An association from the table A refers to an unmapped class: Shortcut
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/.../DataConfiguration.class]:

    Stack Overflow | 2 years ago | AixNPanes
    javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
  6. 0

    how to insert values in database using Hibernate in dynamic web project

    Stack Overflow | 2 years ago | Vishnu Ranganathan
    org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(email)]

  1. kuldeep 16 times, last 3 months ago
  2. esaar 1 times, last 4 months ago
  3. r1chjames 1 times, last 6 months ago
  4. Kawada 6 times, last 6 months ago
  5. Harsh 1 times, last 8 months ago
34 unregistered visitors
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

    Unable to find physical table: BoatInXml

    at org.hibernate.cfg.Mappings.getLogicalTableName()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:476)
    2. org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:523)
    3. org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:729)
    4. org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:410)
    5. org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:371)
    6. org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35)
    7. org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1030)
    8. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:227)
    9. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145)
    9 frames
  3. org.hibernate.test
    ConfigurationTest.testAnnReferencesHbm
    1. org.hibernate.test.annotations.ConfigurationTest.testAnnReferencesHbm(ConfigurationTest.java:142)
    1 frame
  4. Java RT
    DelegatingMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    3 frames
  5. com.intellij.rt
    JUnitStarter.main
    1. com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
    1 frame
  6. Java RT
    DelegatingMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    3 frames
  7. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
    1 frame