-->
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: My class can't fing hibernate.cfg.xml
PostPosted: Tue Oct 21, 2003 6:47 pm 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
Hy have a little test class. I have the following line to load the "hibernate.cfg.xml":

SessionFactory sf = new Configuration().configure().buildSessionFactory(); <<<-----
session = sf.openSession();
tx = session.beginTransaction();

Mp mp = new Mp();
mp.setLegislacao("xpto");
session.save(mp);

tx.commit();
session.close();

He does all the mappings and associations, but right at the end of the above line (<<<----), he gives me:

Exception in thread "main" java.lang.NullPointerException
at pt.comseal.arsol.bo.mp.Maptest.main(Maptest.java:40)

Is he finding my "hibernate.cfg.xml"?

Please help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2003 12:59 am 
Senior
Senior

Joined: Tue Sep 23, 2003 8:18 am
Posts: 137
Location: Johannesburg, South Africa
Perhaps try this:
Code:
SessionFactory sf = new Configuration().configure(new File("hibernate.cfg.xml")).buildSessionFactory();

Failing that. Check the FAQ's at:
Hibernate Users FAQ

-G


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.