Originally, the persistence classes I generated using hibernate are all in COM. po, and later changed to com. xfy. model. under the pojo directory, of course, hibernate. cfg. *. HBM. XML is re-added. This error occurs when I use the findbyid METHOD OF A persistence class. org. hibernate. mappingexception: unknown entity: COM. po. dept
Clearly, the path is already in COM. xfy. model. pojo went down and looked for an hour. That's all right, hibernate. cfg. the path of the configuration file in XML is also correct. Others are correct. It is useless to restart eclipse n times!
Finally, I checked the location where the DaO reported an error and found the problem.
Public dept findbyid (Java. Lang. Integer ID ){
Log. debug ("getting dept instance with ID:" + id );
Try {
Dept instance = (Dept) getsession ()
. Get ("com. Po. Dept", ID); ========This is the problem======
Return instance;
} Catch (runtimeexception re ){
Log. Error ("Get failed", RE );
Throw re;
}
}
The path in the findbyid method has not been changed, but also needs to be changed in the findbyexample method.