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
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:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">
<description>com.foo.Person Entity Mapping</description>
<package>com.foo</package>
<schema>COMMON</schema>
<access>FIELD</access>
<entity class="com.foo.Person" access="FIELD" metadata-complete="true">
<table name="PERSON"/>
<attributes>
<embedded-id name="id"/>
<basic name="name">
<column name="NAME"/>
</basic>
</attributes>
</entity>
<embeddable class="com.foo.Person$Id" access="FIELD">
<attributes>
...
<one-to-one name="address" fetch="LAZY" target-entity="com.foo.Address" >
<join-column name="ADDR_CD" insertable="false" updatable="false"/>
<cascade>
<cascade-all/>
</cascade>
</one-to-one>
</attributes>
</embeddable>
</entity-mappings>
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.
Just experienced this where webapp A used library B, and we'd added a dependency from library B to library C (i.e. B.Foo having a ManyToOne relationship with C.Bar), but the Hibernate config for webapp A didn't include library C in the list of packages to scan. Result: Hibernate didn't know about the entities from library C being referred to.
We did have the same issue but the problem was when extracting an interface from an entity, eclipse refactoring did replace the implemented class name with the interface in other entities.