-->
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.  [ 3 posts ] 
Author Message
 Post subject: Can't map MySQL table
PostPosted: Mon Feb 26, 2007 6:35 am 
Newbie

Joined: Sun Feb 25, 2007 5:02 am
Posts: 5
Hi.

I have a problem with mapping a table in my database:

in my Web.Config i have:
Code:


<session-factory>
     <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
     <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
     <property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
     <property name="connection.connection_string">Server=myHost;Database=realty;User ID=myUser;Password=myPass</property>

     <mapping assembly="Realty.DB" />
   </session-factory>




and in my Contact.hbm.xml i have:
Code:


<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
   namespace="Realty.DB" assembly="Realty.DB">

<class name="Contact" table="Contact">

   <!-- A 32 hex character is our surrogate key. It's automatically
           generated by NHibernate with the UUID pattern. -->
   <id name="Id">
     <column name="id" sql-type="int" not-null="true"/>
     <generator class="uuid.hex" />
   </id>

   <!-- A Contact has to have a name, but it shouldn' be too long. -->
   <property name="FirstName">
     <column name="first_name" />
   </property>
   <property name="FirstName">
     <column name="first_name" />
   </property>
   <property name="LastName">
     <column name="last_name" />
   </property>
   <property name="PhoneHome">
     <column name="phone_home" />
   </property>
   <property name="PhoneMobile">
     <column name="phone_mobile" />
   </property>
   <property name="PhoneOther">
     <column name="phone_other" />
   </property>
   <property name="Email">
     <column name="enail" />
   </property>
   <property name="CreateTime">
     <column name="create_time" />
   </property>
</class>

</hibernate-mapping>



also i have a persistent class in Realty.DB with well formed structure(Properties and their getters/setters) located in App_Code/Realty/DB folder


All this stuff doesn't seems to work, can you explain what's the problem, and how to get rid of it.

Here's the Exception Message:
Could not load file or assembly 'Realty.DB' or one of its dependencies. The system cannot find the file specified.

I've Downloaded MySQL Connector/Net 5 and put adedd as a reference to my project.
I'm using .NET 2.0, MySQL 5.0


P.S. I think that the problem is in <mapping> tag in Web.Config what value should i give to assembly attribute?

Regards Harut, thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 2:08 pm 
Newbie

Joined: Sun Feb 25, 2007 5:02 am
Posts: 5
i've changed the line
Code:
<mapping assembly="Realty.DB" />

to
Code:
<mapping file="G:/SERVERS/IIS/www/App_Code/Realty/DB/Contact.hbm.xml" />


and now i'm getting another error:

Could not load type 'Realty.DB.Contact, NHibernate, Version=1.0.4.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc', check that type and assembly names are correct

can this mean that it can't run under .NET 2.0 ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 5:29 am 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
Try using fully qualified name:

Code:
<mapping>
   <class name="Realty.DB.Contact, Realty.DB" table="Contact">
    ......
   </class>
</mapping>

_________________
Dragos


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