-->
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.  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: The dialect was not set. Set the property hibernate.dialect
PostPosted: Thu Mar 29, 2007 7:10 am 
Newbie

Joined: Thu Mar 29, 2007 6:42 am
Posts: 10
have created a gridview on a page.

I have created a DAL using Nhibernate, as "MF2BO.dll and add as reference to this website..

Code behind for page is :


protected void Page_Load(object sender, EventArgs e)
{
NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
cfg.AddAssembly("MF2BO");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession ses= factory.OpenSession();
IList list = ses.CreateCriteria(typeof(contacts)).List();
GridView1.DataSource = list;
DataBind();
}

When I run it, it shows following error.



Server Error in '/Nhib' Application.
The dialect was not set. Set the property hibernate.dialect.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: NHibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.

Source Error:

Line 19: {
Line 20: NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
Line 21: cfg.AddAssembly("MF2BO");
Line 22: ISessionFactory factory = cfg.BuildSessionFactory();
Line 23: ISession ses= factory.OpenSession();



What's wrong with code.
Hibernate version:1.2rc1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Source File: e:\WebSites\Nhib\Contacts.aspx.cs Line: 21

Stack Trace:

[HibernateException: The dialect was not set. Set the property hibernate.dialect.]
NHibernate.Dialect.Dialect.GetDialect() +120
NHibernate.Dialect.Dialect.GetDialect(IDictionary props) +133
NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +57

[MappingException: Could not compile the mapping document: MF2BO.XML.allClients.hbm.xml]
NHibernate.Cfg.Configuration.LogAndThrow(MappingException me) +62
NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +175
NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name) +65
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) +149
NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) +234
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) +314
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) +36
NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) +182
Contacts.Page_Load(Object sender, EventArgs e) in e:\WebSites\Nhib\Contacts.aspx.cs:21
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3745


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42


Name and version of the database you are using:mssql2005 express

_________________
Sharique uddin Ahmed Farooqui
(Asp.Net,C# developer, IT Consultant)


Top
 Profile  
 
 Post subject: Check Mappings
PostPosted: Thu Mar 29, 2007 12:54 pm 
Regular
Regular

Joined: Sun Jan 21, 2007 4:33 pm
Posts: 65
[MappingException: Could not compile the mapping document: MF2BO.XML.allClients.hbm.xml]

Make sure of the following:

That your mappings are in the appropriate assembly, and that they are syntatically correct. If you need help, check out MyGeneration Software (google it) and look for the Nhibernate template. Also, make sure your paths in the mapping files are correct. Your class looks like it would be MF2BO.XML.allClients, with the assembly being whatever assembly it would be.

You need to post your mapping documents, both the web.config and the MF2BO.XML.allClients.hbm.xml document for me to be able to help you any more than that.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 1:39 pm 
Newbie

Joined: Thu Mar 29, 2007 6:42 am
Posts: 10
I have complied all nhibernate code in a dll.

MF2BO.XML.allClients.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="MF2BO"
assembly ="MF2BO" >
<class name = "allClients"
mutable = "false"
table= "[dbo].[allClients]"
>
<composite-id
>
<key-property
name="contactID"
column="`contactID`"
type="System.Int32"
>
</key-property>
<key-property
name="Name"
column="`Name`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="address"
column="`address`"
type="System.String"
length="100"
>
</key-property>
<key-property
name="city"
column="`city`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="country"
column="`country`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="sex"
column="`sex`"
type="System.String"
length="1"
>
</key-property>
<key-property
name="state"
column="`state`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="email"
column="`email`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="phone"
column="`phone`"
type="System.String"
length="15"
>
</key-property>
<key-property
name="mobile"
column="`mobile`"
type="System.String"
length="15"
>
</key-property>
<key-property
name="company"
column="`company`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="remark"
column="`remark`"
type="System.String"
>
</key-property>
</composite-id>
</class>
</hibernate-mapping>


hibernate.config.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
  <session-factory name="nhibernator">
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    <property name="connection.connection_string">data source=saf-laptop\sqlexpress; initial catalog=E:\WEBSITES\MF2\APP_DATA\SHARIQUE.MDF; user id=sharique; password=sharique;Connection Timeout=10;persist security info=True;</property>
    <property name="show_sql">true</property>
    <property name="prepare_sql">false</property>
    <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
    <property name="use_outer_join">false</property>
    <property name="isolation">ReadCommitted</property>
    <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
    <mapping assembly="MF2BO" />
  </session-factory>
</hibernate-configuration>


_________________
Sharique uddin Ahmed Farooqui
(Asp.Net,C# developer, IT Consultant)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 3:08 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
How are you reading in your hibernate.cfg.xml? If you are not putting this in your web.config file it won't find it...you'll need to tell it the file path where your configuration file resides:
Code:
cfg.Configure(new XmlTextReader(hibernateConfig));


MIKE

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject: The dialect was not set. Set the property hibernate.dialect.
PostPosted: Mon Jul 02, 2007 8:57 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi all.

I´m using Oracle 10g express and i have this error message:

Exception Details: NHibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.

The web.config file:

<configuration>
<configSections>
<section name ="nhibernate" type ="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<nhibernate xmlns ="urn:nhibernate-configuration-2.2">
<add key="hibernate.dialect" value="NHibernate.Dialect.Oracle9Dialect"/>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="hibernate.connection.connection_string" value="Provider=MSDAORA;data source=XE;user id=sam;password=sam"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.OracleDataDriver"/>

</nhibernate>
<appSettings/>
<connectionStrings/>



Could some tell the reason once i set the property according with the NHibernate Reference Documentation version 1.2.0?

Regards,

Welenn


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 10:10 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
I have added this exception to the troubleshooting guide at http://www.hibernate.org/Documentation/NHibernateTroubleshootingGuide.

Look in the logs to find out whether NHibernate picks up your configuration file.


Top
 Profile  
 
 Post subject: Could not load type 'NHibernate.Sabndipt'
PostPosted: Mon Jul 02, 2007 10:37 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi Sergey.

Thank you for the reply.

Now i got this error message :

Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.

Source Error:


Line 17: static NHibernateHelper()
Line 18: {
Line 19: sessionFactory = new Configuration().Configure().BuildSessionFactory();
Line 20: }
Line 21:

What does that mean?

Regards,

Welenn


Top
 Profile  
 
 Post subject: Could not load type 'NHibernate.Sabndipt'
PostPosted: Mon Jul 02, 2007 10:38 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi Sergey.

Thank you for the reply.

Now i got this error message :

Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.

Source Error:


Line 17: static NHibernateHelper()
Line 18: {
Line 19: sessionFactory = new Configuration().Configure().BuildSessionFactory();
Line 20: }
Line 21:

What does that mean?

Regards,

Welenn


Top
 Profile  
 
 Post subject: Could not load type 'NHibernate.Sabndipt'
PostPosted: Mon Jul 02, 2007 10:39 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi Sergey.

Thank you for the reply.

Now i got this error message :

Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.

Source Error:


Line 17: static NHibernateHelper()
Line 18: {
Line 19: sessionFactory = new Configuration().Configure().BuildSessionFactory();
Line 20: }
Line 21:

What does that mean?

Regards,

Welenn


Top
 Profile  
 
 Post subject: Re: Could not load type 'NHibernate.Sabndipt'
PostPosted: Mon Jul 02, 2007 2:00 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
welennAraujo wrote:
Exception Details: System.TypeLoadException: Could not load type 'NHibernate.Sabndipt' from assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.

...

What does that mean?


It means that the type 'NHibernate.Sabndipt' couldn't be loaded from the NHibernate assembly. This makes sense, because it isn't there. What this means is that you probably didn't give a fully qualified type name (or optionally, set the default assembly and namespace) in your mapping file for Sabndipt.


Top
 Profile  
 
 Post subject: The dialect was not set. Set the property hibernate.dialect
PostPosted: Mon Jul 02, 2007 4:44 pm 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Thanks Sergey and Marcal.

I solve the problem.

Following reasons:

THe field 'NHibernate.Sabndipt' was generated by MyGeneration and i don´t know why it has been inserted.

The provider was wrong, so i deleted the key words 'Provider= MSDAORA' hibernate parameter and that works.

There´s a Sdo.geometry field in my database that doesn´t mach with the Nhibernate.Oracle data type, so i gonna finda a way to overwork the problem.

For a better connection i created the file hibernate.cfg.xml and i set the configuration according with the Reference Documentation.


Regards,


Top
 Profile  
 
 Post subject: .
PostPosted: Wed Jul 04, 2007 9:40 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
...


Last edited by welennAraujo on Wed Jul 04, 2007 9:44 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: NHibernate.Spatial
PostPosted: Wed Jul 04, 2007 9:42 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi.

I found the NHibernateSpatial namespace but i can´t set the correct dialect for Oracle10g.


I´ve tried

<property name="dialect">NHibernate.Spatial.Dialect.SpatialDialect,NHibernate.Spatial</property>

But it doesn´t work.



Could someone help me to set it properly?

Regards,

Welenn


Top
 Profile  
 
 Post subject: NHibernate.Spatial
PostPosted: Wed Jul 04, 2007 12:31 pm 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi.

Using Oracle 10g the exception below has been shown:


Exception Details: System.MissingMethodException: Cannot create an abstract class.

Source Error:


Line 64: static NHibernateHelper()
Line 65: {
Line 66: _sessionFactory = new Configuration().Configure().BuildSessionFactory();
Line 67: }
Line 68:


Source File: c:\ProjetosVS\ProjetoWeb\WebAppOO\App_Code\NHibernateHelper.cs Line: 66


Stack Trace:


[MissingMethodException: Cannot create an abstract class.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.Activator.CreateInstance(Type type) +6
NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName) +60

[HibernateException: Could not instantiate dialect class NHibernate.Spatial.Dialect.SpatialDialect,NHibernate.Spatial]
NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName) +163
NHibernate.Dialect.Dialect.GetDialect(IDictionary props) +148
NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +57


I think its because of the dialect but i'm not so sure.


<property name="dialect">NHibernate.Spatial.Dialect.SpatialDialect,NHibernate.Spatial</


Regards.


Top
 Profile  
 
 Post subject: NHibernate.Spatial Oracle Dialect
PostPosted: Fri Jul 06, 2007 10:46 am 
Newbie

Joined: Mon Jul 02, 2007 8:45 am
Posts: 19
Hi all!

I couldn´t find the Oracle Dialect for NHibernate.Spatial namespace.

Could someone help me ?

It´s the first time i´m developing in ASP.NET using NHibernate.

Is very important to me use this to improve the ASP.NET projects in my company.


Regards,

Welenn


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 20 posts ]  Go to page 1, 2  Next

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.