-->
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: Hibernate.properties not found
PostPosted: Sat Jan 05, 2008 9:57 am 
Newbie

Joined: Sat Jan 05, 2008 9:44 am
Posts: 3
Hi, I am new 2 Hibernate, I am using Hibernate 3.0.5. I have made a small application but i;m not able to run it....

Details are as follow...

Source Code Structure...

+src
+com.ibm.myhibernate.config
hibernate.cfg.xml
+com.ibm.myhibernate.hbm
BwAnobagActivity.hbm.xml
+ com.ibm.myhibernate.impl
BwAnobagActivity.java
Myhibernate.java


hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="dialect">
org.hibernate.dialect.DB2Dialect
</property>
<property name="hibernate.connection.driver_class">
com.ibm.db2.jcc.DB2Driver
</property>
<property name="hibernate.connection.url">
jdbc:db2://9.182.249.18:50000/VISTADB
</property>
<property name="hibernate.connection.username">dbuser</property>
<property name="hibernate.connection.password">
welcome2ibm
</property>
<property name="show_sql">true</property>
<!-- Mapping files -->
<mapping
resource="com/ibm/myhibernate/hbm/BwAnobagActivityDE.hbm.xml" />
</session-factory>
</hibernate-configuration>


Myhibernate.java

package com.ibm.myhibernate.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class Myhibernate {

public static void main(String[] args) {
Session session = null;

try{

Configuration configuration = new Configuration();

SessionFactory sessionFactory = configuration.configure("com/ibm/myhibernate/config/hibernate.cfg.xml").buildSessionFactory();

session = sessionFactory.openSession();

System.out.println("Inserting Record");

BwAnobagActivityDE bwAnobagActivityDE = new BwAnobagActivityDE();

bwAnobagActivityDE.setCanobagPlaceOfWork("India");

bwAnobagActivityDE.setTbwAnobagDataId(new Long(1256336));

session.save(bwAnobagActivityDE);

System.out.println("Done");

}catch(Exception e){

System.out.println(e.getMessage());

}finally{

session.flush();

session.close();

}
}
}


When i am trying to run Myhibernate.java

It's giving me exception

INFO: hibernate.properties not found
Jan 5, 2008 7:10:07 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Jan 5, 2008 7:10:07 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Jan 5, 2008 7:10:08 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: com/ibm/myhibernate/config/hibernate.cfg.xml
Jan 5, 2008 7:10:08 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: com/ibm/myhibernate/config/hibernate.cfg.xml
Exception in thread "main" java.lang.NullPointerException
at com.ibm.myhibernate.impl.Myhibernate.main(Myhibernate.java:62)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 05, 2008 12:07 pm 
Newbie

Joined: Thu Jul 26, 2007 5:12 am
Posts: 14
Location: Nepal
i dont think the problem is due to the 'hibernate.properties' file
check for NullPointerException

_________________
:: there are 10 types of people in this world...1 who understands binary and the other 1 who does not ::


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.