0 | |
By: [email protected] On: Wed May 25 16:21:25 IST 2016 0 0 0 | 0 |
Are You Satisfied :0Yes0No |
Hibernate XML mapping file contains the mapping relationship between Java class and database table. This is always named as ?xxxxxx.hbm.xml? and declared in the Hibernate configuration file ?hibernate.cfg.xml?. In your case, you are trying to map employee.hbm.xml to your code. But hibernate is not able to find the classpath of file. you need to check following things given below.-- 1- Check the configuration is done properly in hibernate.cfg.xml <hibernate-configuration> <session-factory> ...... <mapping resource="com/mkyong/common/Stock.hbm.xml"></mapping> ...... </session-factory> </hibernate-configuration> For any reasons you do not want to include the mapping file in hibernate.cfg.xml. Hibernate provides a method for developer to add mapping file programmatically. Just modify the default Hibernate SessionFactory class by passing your ?hbm.xml? file path as an argument into the addResource() method: Java SessionFactory sessionFactory = new Configuration() .addResource("com/mkyong/common/Stock.hbm.xml") .buildSessionFactory(); | 0 |
By: [email protected] On: Mon Jun 06 11:10:59 IST 2016 0 0 0 | 0 |
Are You Satisfied :0Yes0No |