Error while reading the hbm.xml file


#1

I am unable to read hbm.xml. getting the below error.

INFO: HHH000220: Reading mappings from file: Database_configuration_files\Delete.hbm.xml
Error: INFO | jvm 1 | 2018/10/23 13:56:38 | file: Database_configuration_files\Delete.hbm.xml not found.

Please find the attachment with structure.
Please help me to reso

lve this issue


#2

Try it like this:

cfg.addFile("commonInterface/Database_configuration_files/Delete.hbm.xml");

#3

cfg.addFile(“Database_configuration_files/Delete.hbm.xml”) is working fine. when i am creating a runnable jar for the above code. I am getting this error " HHH000220: Reading mappings from file: Database_configuration_files\Delete.hbm.xml ".

Let me know if you need any additional information.


#4

The Configuration bootstrap is deprecated. Also, you need to use a build tool like Maven to build a project, not from the IDE.

In your case, you should use addResource:

cfg.addResource("commonInterface/Database_configuration_files/Delete.hbm.xml");

The addFile works with file paths that can be resolved on disk, not on the classpath. So, unless you are using an absolute file path, the program will run only when the relative path can be resolved from the calling command path.


#5

Thank you so much. This helped me to resolve the issue. Thank you