-->
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.  [ 3 posts ] 
Author Message
 Post subject: new to hibernate, help me
PostPosted: Thu Mar 29, 2007 2:19 am 
Newbie

Joined: Thu Mar 15, 2007 3:50 am
Posts: 1
Hi friends

i am very new to hibernate

i read one tutorial on net and i try to practice that
i created
hibernate.cfg.xml
contact.hbm.xml
Contact.java
FirstExample.java
and all these files are in same folder f:\test
i am able to compile java files
but while running i am getting NullPointerException
because

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

is not working
i hope the problem will be java file unable to locate xml files

how to do this (ie classpath setting )
give some idea

any help greatly cherished

Mallik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 5:44 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Hi dude,

put your xml file in class path.and no need to give file name

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject: Is this works?
PostPosted: Thu Mar 29, 2007 7:21 am 
Newbie

Joined: Thu Mar 29, 2007 7:03 am
Posts: 9
Location: Delhi
Put your hibernate.cfg.xml in classpath and use the following in FirstExample.java

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

_________________
Jini


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.