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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to