-->
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.  [ 1 post ] 
Author Message
 Post subject: property file problem
PostPosted: Mon Sep 27, 2004 9:04 am 
Beginner
Beginner

Joined: Tue May 11, 2004 10:40 am
Posts: 37
Location: Belgium
Hibernate version: 2

Name and version of the database you are using: MySQL

Hi,


I do the following to dynamically set the properties for my database.
I have a property file named hibernate.properties. The variables like
dialect, driver, etc... are certainly not null !

Code:
sessions = new Configuration()
   .addClass(Invoice.class)
   .addClass(Client.class)
   .addClass(Work.class)
   .addClass(Day.class)
   .addClass(Worker.class)
   .setProperty("hibernate.dialect ",dialect)
   .setProperty("hibernate.connection.driver_class ",driver)
   .setProperty("hibernate.connection.url ",url)
   .setProperty("hibernate.connection.username ",username)
   .setProperty("hibernate.connection.password ",password)
   .setProperty(Environment.HBM2DDL_AUTO, "create")
   .buildSessionFactory();


And that's the error I get:
Code:
java.lang.NullPointerException
   at java.util.Hashtable.put(Unknown Source)
   at java.util.Properties.setProperty(Unknown Source)
   at net.sf.hibernate.cfg.Configuration.setProperty(Configuration.java:813)
   at storage.HibernateStorage.configure(HibernateStorage.java:84)
   at storage.HibernateStorage.<init>(HibernateStorage.java:65)
   at control.Control.init(Control.java:52)
   at control.Control.main(Control.java:63)
Exception in thread "main"


Is it because I don't use a xml property file, or ...?

Thanks in advance...
Stijn


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

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.