3:31 pm - Saturday January 21, 2017

Hibernate Error – Problem parsing configuration

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

Error:

Problem parsing configuration
Exception in thread “main”
java.lang.NullPointerExceptionat com.candidjava.Mapclass.addAddress(Mapclass.java:28)at com.candidjava.Mapclass.main(Mapclass.java:68)

solution:

In correct code-

sessionFactory = new Configuration().configure().buildSessionFactory();

correct code:

If your cfg is placed in different location or if it is renamed then load your cfg file manually in configure method
sessionFactory = new Configuration().configure(“com\\xml\\hibernate.cfg.xml”).buildSessionFactory();
for complete code visit here

For a Complete Source Code please click the below link

http://candidjava.com/hibernate-simple-program-using-webapplication-with-eclipse

Filed in: Z-A Hibernate codes

Comments are closed.