i am getting " org.hibernate.MappingException: Could not read mappings from resource: src/emp.hbm.xml" error. below i am pasting .CFG as well as .hbm files. can somebody please help me out.
I have a class as Emp.java which is used for getter and setter and emp_loaded.java where i am creating a session and making transactions. can somebody figure out what's the error.
Somehow, hibernate is not reading emp.hbm.xml file. Make sure emp.hbm.xml is in src folder and if you are running standalone then be sure that src folder is in the path env. You have to make src folder available at runtime.
I link provided by you was pretty useful and not my problem is resolved but now i am facing another error. i am not been able to connect to my MYSQL database. I think there is some problem in registering the driver. the error i got is:
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:57) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56) at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174) at src.Emp_loader.main(Emp_loader.java:21)
my cfg file is as follows:-
i have also tried to put 'mysql-connector-java-3.1.11' in my 'C:\eclipse\plugins' folder as well as i tried to include this as a jar in build path lib. but nothing positive comes out. can you suggest me something?
sorry for spell mistakes -- take "I link provided by you was pretty useful and not my problem is resolved but now i am facing another error" as "The link provided by you was pretty useful and now my problem is resolved but now i am facing another error"
No need to copy your jar under C:\eclipse\plugins folder. You have to add it in your eclipse project location. Java Build Path -> Libraries Tab Page -> Add External Jar and then provide the location of your jar ... thats all, you are all set.