While running
Configuration cfg = new Configuration.configure();
throws NullPointerException. I tried both hibernate.properties and hibernate.cfg.xml files, bot are in class path. Configuration file posted below:
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<session-factory name="java:comp/env/hibernate/SessionFactory">
<!-- properties -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.username">user</property>
<property name="connection.password">password</property>
<property name="connection.url">jdbc
racle:thin:@localhost:1521
b</property>
<property name="connection.datasource">my/first/datasource</property>
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<property name="batch_size">25</property>
<!-- mapping files -->
<mapping resource="com/hibernate/beans/Product.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Please let me know if you know what might be happening.
Thank you.
Java Code:
cfg.addClass(com.hibernate.beans.Product.class);
SessionFactory sessions = cfg.buildSessionFactory();
return sessions.openSession();
[ May 25, 2004: Message edited by: Roman Merkushen ]