Hi i tried out the suggested one. but is giving the same exception.
but surprisingly when i commented all the code related to resource addition , it is working !!! can you figure out how it is possible?
here is my latest code....
configuration.setProperty("connection.driver_class","com.mysql.jdbc.Driver");
configuration.setProperty("connection.url","jdbc:mysql://localhost:3306/demo");
configuration.setProperty("hibernate.connection.username","root");
configuration.setProperty("hibernate.connection.password","root");
configuration.setProperty("hibernate.dialect","org.hibernate.dialect.SQLServerDialect");
configuration.setProperty("hibernate.connection.pool_size","10");
//configuration.addFile("Login.hbm.xml");
//configuration.addFile("User.hbm.xml");
//configuration.addClass(Login.class);
//configuration.addClass(User.class);
configuration.configure();
amila733 wrote:
Hi
it is because of rong location of .hbm.xml files. I see that in your previoues cfg.xml mapping files at model/User.hbm.xml but in your new code it is only User.hbm.xml . that is the cause.
You can write
configuration.addClass(A.class) instead of this
configuration.addResource("Login.hbm.xml");
in here your mapping files should with your .class files
Amila
(Don't forget to rate if helps)