Ah, it is probably easy.
In hobermate.cfg.xml change the line with following.
<property name="connection.connection_string">
Server=(local);initial catalog=nhibernate;Integrated
Security=SSPI
</property>
and set the dialect to following
<property
name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
in case the driver is different, use
<property
name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
On Mon, Nov 3, 2008 at 6:36 PM, HelpNH <[EMAIL PROTECTED]> wrote:
>
> Hi,
> yes sorry from the project SimpleDemo of Mr.Quicoli,
> i rewrite that project (that's to learn and study Nhibernate With
> WPF) when i set up the file "Hibernate.cfg.xml" ,
> "Contact.hbm.xml" and "Phone.hbm.xml" to connect the Sql Server with
> the NHibernate i receive an error...
> My Purpose is connect that project with Sql Server changing the
> original project files(it's for Firebird) of mappings with the new
> but i receive only errors:
> Do you have some idea where i can wrong?
> Thanks so much for the reply.
> Have a happy time.
> BYE
>
>
>
> On Nov 3, 11:25 pm, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote:
> > Can you rephrase what you are trying to do, i am lost a little.
> >
> >
> >
> > On Mon, Nov 3, 2008 at 5:22 PM, HelpNH <[EMAIL PROTECTED]> wrote:
> >
> > > Hi ,
> > > i 'm searching to work out my mistake but nothing ,
> > > do you have some eye to correct my view?
> > > Thanks so much
> > > I wish you happy time.
> > > Bye
> >
> > > On Nov 1, 10:29 am, HelpNH <[EMAIL PROTECTED]> wrote:
> > > > HI Sean ,
> > > > i tried to change in the mapping <generator class="identity" /> but
> > > > when i debug the project
> > > > and i wish add a new contact appear this the follow:
> >
> > > > _______ADOException was unhandled_________
> > > > could not execute query
> > > > [ SELECT this_.Id_Contact as Id1_1_1_, this_.Name as Name1_1_,
> > > > phones2_.Id_Contact as Id4_3_, phones2_.Id_Phone as Id1_3_,
> > > > phones2_.Id_Phone as Id1_0_0_, phones2_.PhoneType as PhoneType0_0_,
> > > > phones2_.PhoneNumber as PhoneNum3_0_0_ FROM ContactTbl this_ left
> > > > outer join PhoneTbl phones2_ on this_.Id_Contact=phones2_.Id_Contact
> > > > WHERE this_.Id_Contact = ? ]
> > > > Positional parameters: #0>0
> > > > [SQL: SELECT this_.Id_Contact as Id1_1_1_, this_.Name as Name1_1_,
> > > > phones2_.Id_Contact as Id4_3_, phones2_.Id_Phone as Id1_3_,
> > > > phones2_.Id_Phone as Id1_0_0_, phones2_.PhoneType as PhoneType0_0_,
> > > > phones2_.PhoneNumber as PhoneNum3_0_0_ FROM ContactTbl this_ left
> > > > outer join PhoneTbl phones2_ on this_.Id_Contact=phones2_.Id_Contact
> > > > WHERE this_.Id_Contact = ?]
> >
> > > > i don't know why ,however i add into the database ID as Identity
> > > > Specification = yes after in the subMenu there are Identity Increment
> > > > = 1 ; Identity Seed = 1;
> >
> > > > Where i wrong :(???
> > > > Thanks
> > > > Have a happy day.
> > > > Bye
> >
> > > > On Oct 31, 6:35 pm, "Sean Carpenter" <[EMAIL PROTECTED]> wrote:
> >
> > > > > The issue is that the "sequence" ID generator is not supported on
> MS
> > > SQL
> > > > > Server. You could change the mapping to <generator
> class="identity" />
> > > to
> > > > > have it work on SQL Server. Other ID generator strategies work on
> SQL
> > > > > Server as well, but "identity" is similar to "sequence" and will
> work
> > > fine
> > > > > for testing.
> > > > > Sean Carpenter
> >
> > > > > On Thu, Oct 30, 2008 at 10:22 PM, HelpNH <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > > On Oct 30, 7:22 pm, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
> > > > > > > Hi HelpNH (aka pinkfloyd_mn)Here is a useful link to configure
> NH:
> >
> > >http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-applicat.
> ..
> >
> > > > > > > 2008/10/30 HelpNH <[EMAIL PROTECTED]>
> >
> > > > > > Hi Fabio ,
> > > > > > your link is useful and clear,good...
> > > > > > but i have some trouble to mapping the project of Quicoli with
> SQL
> > > > > > Server .
> > > > > > I studied that project to learn some feature about NHibernate
> with
> > > WPF
> > > > > > i rewrite the project
> > > > > > but when i change the mapping file and Configuration file of
> > > > > > NHibernate to connect the project
> > > > > > with the database i begin to meet difficulties....now i will post
> the
> > > > > > mapping files and Hibernate.cfg.xml that
> > > > > > i created to connect with SQL Server.
> >
> > > > > > I Show what i done:
> >
> > > > > > This is the original <Hibernate.cfg.xml> of Quicoli's project:
> >
> > > > > > <?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="dialect">NHibernate.Dialect.FirebirdDialect</
> > > > > > property>
> > > > > > <property
> >
> > > name="connection.driver_class">NHibernate.Driver.FirebirdClientDriver</
> > > > > > property>
> > > > > > <property
> >
> > >
> name="connection.connection_string">User=SYSDBA;Password=masterkey;Database=WPFNH-
> > > > > > Demo;DataSource=localhost;Dialect=3;
> Charset=NONE;Role=;Connection
> > > > > > lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet
> > > > > > Size=8192;ServerType=1;</property>
> > > > > > <property name="connection.isolation">ReadCommitted</property>
> > > > > > <property name="use_proxy_validator">false</property>
> >
> > > > > > <!--For tests only-->
> > > > > > <property name="show_sql">true</property>
> > > > > > </session-factory>
> > > > > > </hibernate-configuration>
> >
> > > > > > instead i do so to connect with SQL Server
> >
> > > > > > <?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="dialect">
> > > > > > NHibernate.Dialect.MsSql2005Dialect
> > > > > > </property>
> > > > > > <property name="connection.driver_class">
> > > > > > NHibernate.Driver.SqlClientDriver
> > > > > > </property>
> > > > > > <property name="connection.connection_string">
> > > > > > Data Source=ERUSYAKO\SQLEXPRESS;Integrated
> > > > > > Security=True; initial
> > > > > > catalog=DemoWPF
> > > > > > </property>
> > > > > > <property
> name="use_proxy_validator">false</property>
> > > > > > </session-factory>
> > > > > > </hibernate-configuration>
> >
> > > > > > and now there are the mapping files of the classes
> > > > > > <Contact.hbm.xml>
> > > > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > > > > > assembly="Domain" namespace="Domain" >
> > > > > > <class name="Contact" table="ContactTbl" >
> > > > > > <id name="Id" column="Id_Contact" type="Int64"
> > > > > > unsaved-value="0">
> > > > > > <generator class="sequence">
> > > > > > <param
> name="sequence">gen_ids</param>
> > > > > > </generator>
> > > > > > </id>
> > > > > > <property name="Name" column="Name" type="string"
> > > > > > not-null="true" /
> >
> > > > > > <bag name="Phones" generic="true"
> > > > > > cascade="all-delete-orphan">
> > > > > > <key column="Id_Contact" />
> > > > > > <one-to-many class="Phone"/>
> > > > > > </bag>
> > > > > > </class>
> > > > > > </hibernate-mapping>
> >
> > > > > > and <Phone.hbm.xml>
> >
> > > > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > > > > > assembly="Domain" namespace="Domain" >
> > > > > > <class name="Phone" table="PhoneTbl" >
> > > > > > <id name="Id" column="Id_Phone" type="Int64"
> > > > > > unsaved-value="0">
> > > > > > <generator class="sequence">
> > > > > > <param
> name="sequence">gen_ids</param>
> > > > > > </generator>
> > > > > > </id>
> > > > > > <property name="PhoneType" column="PhoneType"
> > > > > > not-null="true" />
> > > > > > <property name="PhoneNumber" column="PhoneNumber"
> > > > > > type="string" not-
> > > > > > null="true" />
> > > > > > </class>
> > > > > > </hibernate-mapping>
> >
> > > > > > when i debug the project and i wish add a new contact appear an
> > > > > > error :"MappingException was unhandled- could not instantiate id
> > > > > > generator" ...i don't know where i wrong.
> > > > > > Do you have some advice to work out that?
> >
> > > > > > Thanks so much and for the support .
> > > > > > I wish you happy time.
> > > > > > Bye
> >
> > > > > > > > How all,
> > > > > > > > after that Paulo Quicoli post the project SimpleDemo about
> > > Nhibernate
> > > > > > > > with WPF i studying his project and i rewrite the same
> project to
> > > > > > > > learn some features till now that's all right but i met a
> > > > > > > > trouble ,on the SimpleDemo project mr.Paulo use Firebird
> instead
> > > i
> > > > > > > > use SQL Server/Express so i wish change the configuration of
> > > > > > > > Hibernate.cfg.xml and the files into the Mapping folder just
> to
> > > > > > > > connect the project with the database of SQL Server but i
> cannot
> > > > > > > > (again) or better i dont know the right way to change those
> > > > > > > > configuation file,so there is somebody that can help me ???
> > > > > > > > Thank so much for the attention.
> > > > > > > > Have a happy time.
> > > > > > > > Bye
> >
> > > > > > > > Here there is project of PauloQuicoli
> >
> > >http://cid-b27ccfaa07b93be8.skydrive.live.com/self.aspx/Public/WPF-NH.
> > > > > > ..
> >
> > > > > > > --
> > > > > > > Fabio Maulo
> >
> > --
> > Tuna Toksöz
> >
> > Typos included to enhance the readers attention!
> >
>
--
Tuna Toksöz
Typos included to enhance the readers attention!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---