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.  [ 11 posts ] 
Author Message
 Post subject: Help me to come out of Dialect Error
PostPosted: Thu Dec 18, 2008 9:33 am 
Newbie

Joined: Thu Dec 18, 2008 9:09 am
Posts: 6
Hi,
I am new to nHibernate and i am facing some problem while accessing the application. I have downloaded the latest version of nHibernate. I am having the UserInfo as class and trying with SQL server as backend. Very simple class and .hbm.xml file. I have searched all the internet content and applied as per their suggestions. Still i am facing "Could not find the dialect in the configuration". Please suggest.

With Regards
Shyam Sundar R


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2008 10:29 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Can you post your configuration file and the code where you build the session factory ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2008 7:24 am 
Newbie

Joined: Thu Dec 18, 2008 9:09 am
Posts: 6
This is my hibernate.cfg.xml file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="hibernate.dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Data Source=FirstSample.sdf</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>

I have single form with button, the following code snippet will be for button_Click

Configuration config = new Configuration().Configure();

config.AddAssembly((typeof(UserInfo).Assembly));

ISessionFactory sessionFactory = config.BuildSessionFactory();
ISession session = sessionFactory.OpenSession();
ITransaction transaction = session.BeginTransaction();

UserInfo currentUser = new UserInfo();
currentUser.Name = "Shyam Sundar";
currentUser.Password = "success";
currentUser.Email = "someone@mirror.com";
currentUser.Company = "HCL";

session.Save(currentUser);
transaction.Commit();
session.Close();

This is my UserInfo.Hbm.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="HibernatorSample" namespace="HibernatorSample">
<class name="UserInfo" >
<id name="Id" column="LoginId">
<generator class="assigned" />
</id>
<property name="Name" column="Name" type="String" length="50"/>
<property name="Password" type="String" length="20"/>
<property name="Email" column="Email" type="String" length="50"/>
<property name="Company" column="Company" type="String" length="50"/>
</class>
</hibernate-mapping>

I have created the table in local sql server. I have tried with various ways. Please suggest me a link, i need to run a sample application with nHibernate. Thanks for your help
Shyamdvk


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2008 7:33 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Is your hibernate.cfg.xml marked as "Embedded Resource" ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Dilect Problem
PostPosted: Fri Dec 19, 2008 7:44 am 
Newbie

Joined: Thu Dec 18, 2008 9:09 am
Posts: 6
Yes it Embeded only..I have checked once again. Is there anything do i need to change in the code? or give me the sampel file location so that i can download and start loot at the action. Your reple is appreciated

Shyamdvk


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2008 7:58 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Which hibernate version are you using ? If it's 2.0 you don't need "hibernate." for the properties anymore:

<property name="dialect">...</property>

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re:
PostPosted: Fri Dec 19, 2008 8:05 am 
Newbie

Joined: Thu Dec 18, 2008 9:09 am
Posts: 6
Latest one i am using.

Shyamdvk


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2008 8:07 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
So does it work if you remove "hibernate." from your dialect configuration ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Still i am facing a problem
PostPosted: Fri Dec 19, 2008 8:31 am 
Newbie

Joined: Thu Dec 18, 2008 9:09 am
Posts: 6
Sorry to say, i am facing the same problem

Shyamdvk


Top
 Profile  
 
 Post subject: New Try
PostPosted: Fri Dec 19, 2008 9:08 am 
Newbie

Joined: Thu Dec 18, 2008 9:09 am
Posts: 6
Hi,
Thanks for your effort. I have downloaded the new sample from http://www.hibernate.org/379.html and configured my database too. Program complied without any error. While running i have received the following error
"The type initializer for 'OrderSystem.UI.NHibernateSessionFactory' threw an exception."
and the inner Exception says that

Could not compile the mapping document: OrderSystem.Objects.Mappings.Product.hbm.xml"

and

InnerException
{"There is an error in XML document (1, 2)."}

I have not altered anything in the code. What could be the reason for this error. Where i need to change in the code, anything that i have missed? Just curious. Need your assistance in this please

Shyamdvk


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2008 9:36 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
That's probably an old example which still uses a version < 1.2 (where the xml namespace has been changed). Go back to your own example and try to set the build action to "None" and copy to output directory to "Copy Always". I'm always mixing that up with the config files.

_________________
--Wolfgang


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