-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Null pointer Exception
PostPosted: Mon Sep 11, 2006 7:39 am 
Newbie

Joined: Mon Sep 11, 2006 7:35 am
Posts: 1
HI I got the exception while using this below code.

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();


java.lang.NullPointerException
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:45)
Exception in thread "main"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 2:37 pm 
Newbie

Joined: Mon Sep 11, 2006 4:50 pm
Posts: 10
Hi,
You should pass the hibernate configuration xml (hibernate.cfg.xml) to the configure method.

Code:
SessionFactory sessionFactory = new Configuration().configure("/hibernate.cfg.xml").buildSessionFactory();


In this example, the hibernate.cfg.xml should be in your src folder.

Good luck!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.