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

Hibernate JIRA | Ole Jørgen Aurebekk | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    As posted on the forum : ( http://forum.hibernate.org/viewtopic.php?t=963737 ) (Might be a duplicate of http://opensource.atlassian.com/projects/hibernate/browse/ANN-362 ) Attached is a minimized testcase (run FileFail). ----------------------------- I'm converting a kind of complicated application to use hibernate+annotations for persistence. I'm stuck with the old classnames like "File" which creates some problems for me. I can annotate it like this, avoiding reserved words conflicts : @Entity @Table(name = "`File`") public class File ... and it works nicely until I try to make a manytomany relation like this : @ManyToMany(targetEntity=FileFolder.class ) @JoinTable( name="File_FileFolder", joinColumns={@JoinColumn(name="File_id")}, inverseJoinColumns={@JoinColumn(name="FileFolder_id")} ) private List virtualFolders; What happens is I get an exception when creating my session factory : org.hibernate.MappingException: Unable to find physical table: File at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:473) at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:520) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:866) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:527) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:468) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1049) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1205) at HibernateSessionFactory.currentSession(HibernateSessionFactory.java:15) at Filefail.main(Filefail.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Exception in thread "main" java.lang.NullPointerException at HibernateSessionFactory.currentSession(HibernateSessionFactory.java:21) at Filefail.main(Filefail.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) It seems the relation somehow makes Hibernate forget that my File-class is mapped to `File`...

    Hibernate JIRA | 1 decade ago | Ole Jørgen Aurebekk
    org.hibernate.MappingException: Unable to find physical table: File
  2. 0

    As posted on the forum : ( http://forum.hibernate.org/viewtopic.php?t=963737 ) (Might be a duplicate of http://opensource.atlassian.com/projects/hibernate/browse/ANN-362 ) Attached is a minimized testcase (run FileFail). ----------------------------- I'm converting a kind of complicated application to use hibernate+annotations for persistence. I'm stuck with the old classnames like "File" which creates some problems for me. I can annotate it like this, avoiding reserved words conflicts : @Entity @Table(name = "`File`") public class File ... and it works nicely until I try to make a manytomany relation like this : @ManyToMany(targetEntity=FileFolder.class ) @JoinTable( name="File_FileFolder", joinColumns={@JoinColumn(name="File_id")}, inverseJoinColumns={@JoinColumn(name="FileFolder_id")} ) private List virtualFolders; What happens is I get an exception when creating my session factory : org.hibernate.MappingException: Unable to find physical table: File at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:473) at org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:520) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:866) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:527) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:468) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1049) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1205) at HibernateSessionFactory.currentSession(HibernateSessionFactory.java:15) at Filefail.main(Filefail.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Exception in thread "main" java.lang.NullPointerException at HibernateSessionFactory.currentSession(HibernateSessionFactory.java:21) at Filefail.main(Filefail.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) It seems the relation somehow makes Hibernate forget that my File-class is mapped to `File`...

    Hibernate JIRA | 1 decade ago | Ole Jørgen Aurebekk
    org.hibernate.MappingException: Unable to find physical table: File
  3. 0

    Unable to instantiate custom type error in Hibernate mapping Enum mapping

    Stack Overflow | 4 years ago | Johnny
    org.hibernate.MappingException: Unable to instantiate custom type: org.hibernate.type.EnumType
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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

  1. kuldeep 16 times, last 5 months ago
  2. esaar 1 times, last 7 months ago
  3. r1chjames 1 times, last 8 months ago
  4. Kawada 6 times, last 9 months ago
  5. Harsh 1 times, last 11 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: File

    at org.hibernate.cfg.Mappings.getLogicalTableName()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:473)
    2. org.hibernate.cfg.Mappings.getLogicalTableName(Mappings.java:520)
    3. org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:866)
    4. org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:527)
    5. org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:468)
    6. org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35)
    7. org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1049)
    8. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
    9. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1205)
    9 frames
  3. Unknown
    Filefail.main
    1. HibernateSessionFactory.currentSession(HibernateSessionFactory.java:15)
    2. Filefail.main(Filefail.java:21)
    2 frames
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:585)
    4 frames
  5. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    1 frame