-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping ASP.NET DropDownList to SQL Server 2005 Tabel
PostPosted: Wed Jun 03, 2009 2:49 pm 
Newbie

Joined: Wed Jun 03, 2009 2:36 pm
Posts: 1
I am trying to use NHibernate to map an ASP.NET dropdownlist to a tabel in a SQL Server 2005 database. The table (SiteCANS) where i want to insert data has a foreign key relationship with another table in the database (Members). I think my problem is mapping this relationship using NHibernate. My mapping file code is as follows:

SiteCANS:
Code:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
  <class name="WiscNet.Database.Model.SiteCANS, WiscNet.Database.Model" table="SiteCANS"
     proxy="WiscNet.Database.Model.SiteCANS, WiscNet.Database.Model">
    <id name="SiteCode" column="SiteCode" type="String">
      <generator class="identity" />
    </id>
    <property name="CAN" column="CAN" type="String" length="50" not-null="false" />
    <many-to-one
        name="Member"
        class="WiscNet.Database.Model.Member, WiscNet.Database.Model"
        column="SiteCode" />
  </class>
</hibernate-mapping>


Members
Code:
    <bag name="SiteCANS" table="SiteCANS" order-by="SiteCode">
      <key column="SiteCode" />
      <one-to-many class="WiscNet.Database.Model.SiteCANS, WiscNet.Database.Model"/>
    </bag>
  </class>


When I use the above, I get a "Specified cast is not valid error". Anyone know why?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.