Hibernate throwing NullPointerException - processFkSecondPassInOrder

前端 未结 3 692
既然无缘
既然无缘 2020-12-20 04:21

Has anyone seen this message before?

There is some discussions on Hibernate forums with not much clarity as to what the issue might be.

We are running Hibern

3条回答
  •  盖世英雄少女心
    2020-12-20 04:32

    So we found the problem. It is just unfortunate that the there isn't some standard Configuration Exception that is thrown when Hibernate is unable to find the FK like "Hey dummy, I can't find the FK that you have defined in the orm file."

    We have two objects under the same schema/db:

    class Person {
      Long id;
      String name;
      Address address;
      ...
    }
    

    So the Address object is a one to one that exists as part of a composite key:

    
    
         com.foo.Person Entity Mapping
         com.foo
         COMMON
         FIELD
         
            
                    
                    
                            
                    
                
            
            ...
            
                
                
                    
                
            
            
         

    The problem was that we moved the Address object to another schema on another db and left the relationship in the orm file (so Address was still a one-to-one in the composite key).

    To fix it, we disconnected the relationship and made Address transient so that we retrieve it a different way and that removed the exception from happening.

    提交回复
    热议问题