-->
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: Problem with hibernate.cfg.xml
PostPosted: Tue Sep 06, 2005 9:14 am 
Newbie

Joined: Fri Nov 14, 2003 8:37 am
Posts: 14
Location: Hamburg - Germany
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0.5

Mapping documents:
hibernate.cfg.xml
<hibernate-configuration>

<session-factory>
<property name="myeclipse.connection.profile">OracleCSC</property>
<property name="connection.url">
jdbc:oracle:thin:@myhost:1521:CSC
</property>
<property name="connection.username">app</property>
<property name="connection.password">app</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="database.product">Oracle 9i</property>
</session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():
Configuration config = new Configuration();
config.addClass(Tracking.class);

SessionFactory sessionfactory = null;
Session session = null;
Transaction tx = null;

try {
sessionfactory = config.buildSessionFactory();
session = sessionfactory.openSession();

tx = session.beginTransaction();

Tracking tracking = new Tracking();
tracking.setEnteredshop(new Long("1122360860490"));
tracking.setOmsid("1324567980");
tracking.setPartnerId("0061742467");
tracking.setCategory("1"); //null,1,2,3
tracking.setShopDay(new Long("1"));
tracking.setShopMonth(new Long("8"));
tracking.setShopYear(new Long("2005"));

session.save(tracking);
tx.commit();
} catch(Exception e) {
e.printStackTrace();

if(tx != null) {
tx.rollback();
}
} finally {
session.close();
sessionfactory.close();
}


Full stack trace of any exception that occurs:
org.hibernate.connection.UserSuppliedConnectionProvider - No connection properties specified - the user must supply JDBC connections
org.hibernate.HibernateException: database product name cannot be null
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at mypackage.TrackingFiller.main(TrackingFiller.java:22)
java.lang.NullPointerException
mypackage.TrackingFiller.main(TrackingFiller.java:46)
Exception in thread "main"


Name and version of the database you are using:
Oracle 9i


I cannot find any hint in the docs or google. Any help would be appreciated!

Regards,

Chris


Top
 Profile  
 
 Post subject: Solved: Problem with hibernate.cfg.xml
PostPosted: Tue Sep 06, 2005 9:34 am 
Newbie

Joined: Fri Nov 14, 2003 8:37 am
Posts: 14
Location: Hamburg - Germany
had to call:
sessionfactory = config.configure().buildSessionFactory();

instead of:
sessionfactory = config.buildSessionFactory();

Regards,

Chris


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.