java.lang.NullPointerException

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.

  • 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`...
    via by Ole Jørgen Aurebekk,
  • 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`...
    via by Ole Jørgen Aurebekk,
    • 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)
    No Bugmate found.