-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate dialect problem
PostPosted: Fri Feb 10, 2006 12:10 am 
Newbie

Joined: Fri Feb 10, 2006 12:04 am
Posts: 2
Hi,

When I try to use HIbernate I get the followin error :

org.hibernate.HibernateException: Hibernate Dialect must be explicitly set


This is my hibernate.cfg.xml :
---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.password">pieczarka</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/pieczarki</property>
<property name="hibernate.connection.username">pieczarka</property>
<property name="hibernate.default_schema">public</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
</session-factory>
</hibernate-configuration>
---
Session session = sessions.openSession();
Transaction tx = session.beginTransaction();
Store st = (Store) session.load(Store.class, new Long(1));
st.setMemo("Memoooo");
st.setName("namienamie");
tx.commit();
session.close();

Can You tell me where is the problem ?
I was seraching the forum, google and else, but I didn't find any solution

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 12:27 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Check that you're using that .xml file. It may be that an old version is still in use (e.g. the version in your src directory is correct, but the version in your bin directory or jar is wrong). Maybe move the file to some patently incorrect location, and if your test doesn't complain about a missing config file, then you know that there's another, incorrect config file lying around somewhere.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 3:20 am 
Newbie

Joined: Fri Feb 10, 2006 12:04 am
Posts: 2
I have check this, I have only one file hibernate.cfg.xml.
I still do not know where is the problem.
Below is part from my log :

[lut 10 08:16:48] INFO - Reading mappings from resource: Store.hbm.xml
[lut 10 08:16:48] DEBUG - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
[lut 10 08:16:48] DEBUG - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
[lut 10 08:16:48] INFO - Mapping class: Store -> store
[lut 10 08:16:48] DEBUG - Mapped property: id -> id
[lut 10 08:16:48] DEBUG - Mapped property: name -> name
[lut 10 08:16:48] DEBUG - Mapped property: memo -> memo
[lut 10 08:16:48] DEBUG - Preparing to build session factory with filters : {}
[lut 10 08:16:48] DEBUG - processing extends queue
[lut 10 08:16:48] DEBUG - processing collection mappings
[lut 10 08:16:48] DEBUG - processing native query and ResultSetMapping mappings
[lut 10 08:16:48] DEBUG - processing association property references
[lut 10 08:16:48] DEBUG - processing foreign key constraints
[lut 10 08:16:48] WARN - No connection properties specified - the user must supply JDBC connections
[lut 10 08:16:48] ERROR - Error calling action method of component with id submit

.....
.....

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.faces.el.EvaluationException: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
... 27 more
Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
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:378)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
----


And I forget to show the all lines from java file :

Configuration cfg = new Configuration();
cfg.addResource("Store.hbm.xml");
cfg.setProperties(System.getProperties());
SessionFactory sessions = cfg.buildSessionFactory();


Session session = sessions.openSession();
Transaction tx = session.beginTransaction();
Store st = (Store) session.load(Store.class, new Long(1));
st.setMemo("Memoooo");
st.setName("namienamie");
tx.commit();
session.close();

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 1:46 pm 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
try adding your cfg.xml file also to the configuration object.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 10, 2006 2:04 pm 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
also i am using

Code:
<property name="[color=red]dialect[/color]">org.hibernate.dialect.PostgreSQLDialect</property>


instead of "hibernate.dialect" you can try this also.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.