-->
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.  [ 4 posts ] 
Author Message
 Post subject: Several ISessionFactory - "dialect was not set" Ex
PostPosted: Sat Jun 04, 2005 1:31 am 
Newbie

Joined: Sat Jan 15, 2005 9:17 am
Posts: 10
Hi Ppl.

Could somebody please shed some light on why the following code and the
accompanying vax.cfg.xml file cause the Exception mentioned, "NHibernate.MappingException"? Thank You.

Secondly, Do I need the 'mapping' element in the XML file when I have the AddAssembly() call to the Configuration?

==============================================
Dim vaxSessionFactory As NHibernate.ISessionFactory = _
New Cfg.Configuration().AddAssembly("Vax-MT-Sema").Configure("vax.cfg.xml").BuildSessionFactory()

==============================================
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0" >
<session-factory name="vax-SF">
<!-- properties -->
<property name="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="hibernate.connection.connection_string">Server=localhost;initial catalog=vax;Integrated Security=SSPI</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.prepare_sql">true</property>
<property name="hibernate.dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<!-- mapping files -->
<!-- mapping assembly="Vax-MT-Sema" / -->
</session-factory>

</hibernate-configuration>
===============================================

Rico.


Top
 Profile  
 
 Post subject: Several ISessionFactory - "dialect was not set" Ex
PostPosted: Sun Jun 05, 2005 3:55 am 
Newbie

Joined: Sat Jan 15, 2005 9:17 am
Posts: 10
All right. I've figured it out. It took some *thinking* about what we're doing
instead of expecting it to 'just work'. I like that actually.

Configure() needs to be called before AddAssembly() :

Dim vaxSessionFactory As NHibernate.ISessionFactory = _
New Cfg.Configuration().Configure("vax.cfg.xml") _
.AddAssembly("Vax-MT-Sema") _
.BuildSessionFactory()

Good to note:
app.config-style files are not meant for Configure(String resource) :P

"Secondly, Do I need the 'mapping' element in the XML file when I have the
AddAssembly() call to the Configuration?"
Since it got things to work, I guess so.

Rico.


Top
 Profile  
 
 Post subject: Re: Several ISessionFactory - "dialect was not set"
PostPosted: Sun Jun 05, 2005 3:16 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
Ras_Nas wrote:
Dim vaxSessionFactory As NHibernate.ISessionFactory = _
New Cfg.Configuration().Configure("vax.cfg.xml") _
.AddAssembly("Vax-MT-Sema") _
.BuildSessionFactory()


Where did you put your vax.cfg.xml file. I am trying to do this, and it can't seem to find my file, which I named hibernate.cfg.xml.

Ras_Nas wrote:
"Secondly, Do I need the 'mapping' element in the XML file when I have the AddAssembly() call to the Configuration?"
Since it got things to work, I guess so.


I would expect not. Did you try it without that?

BOb


Top
 Profile  
 
 Post subject: Re: Several ISessionFactory - "dialect was not set"
PostPosted: Mon Jun 06, 2005 12:26 pm 
Newbie

Joined: Sat Jan 15, 2005 9:17 am
Posts: 10
Pilotbob wrote:
Ras_Nas wrote:
Dim vaxSessionFactory As NHibernate.ISessionFactory = _
New Cfg.Configuration().Configure("vax.cfg.xml") _
.AddAssembly("Vax-MT-Sema") _
.BuildSessionFactory()


Where did you put your vax.cfg.xml file. I am trying to do this, and it can't seem to find my file, which I named hibernate.cfg.xml.


It goes in the same folder as the assembly.
As 'Embedded Resource' it didn't seem to work.

Pilotbob wrote:
Ras_Nas wrote:
"Secondly, Do I need the 'mapping' element in the XML file when I have the AddAssembly() call to the Configuration?"
Since it got things to work, I guess so.


I would expect not. Did you try it without that?

BOb


Okay. I did eventually. It still works it seems.

Rico.


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