I believe int32 can be max int(10) in the database. you have int(11)

On 17 pro, 13:45, elias <[email protected]> wrote:
> Hi,
>
> I'm trying to set up my first nhibernate project. But I have some
> trouble.
> Could someone of you help me out? I'll get this error:
> Exception
>         NHibernate.PropertyAccessException: Invalid Cast (check your mapping
> for property type mismatches); setter of DataTransfer.user --->
> System.InvalidCastException: Specified cast is not valid.
>
> The following things are my files: (database, scheme and class)
>
> DATABASE
> userid  int(11)         auto_increment
> userTypeID      int(11)
> voornaam        varchar(100)
> amforaID        int(11)
> familienaam     varchar(100)
> postcode        varchar(6)
> straat  varchar(100)
> gemeente        varchar(100)
> telefoon        varchar(16)
> gsm     varchar(16)
> geboortedatum   date
> geslacht        varchar(1)
> actief  tinyint(1)
> geboorteplaats  varchar(100)
> sid     varchar(200)
>
> XML SCHEME
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="DataTransfer" namespace="DataTransfer">
>   <class name="DataTransfer.user,DataTransfer" table="user">
>     <id name="Id" column="userid" type="Int32" unsaved-value="0">
>       <generator class="native"></generator>
>     </id>
>     <property name="UserTypeId" column="userTypeID" type="string"
> length="50" not-null="true"/>
>     <property name="Voornaam" column="voornaam" type="string"
> length="100" not-null="true"/>
>     <property name="Familienaam" column="familienaam" type="string"
> length="100" not-null="true"/>
>     <property name="Postcode" column="postcode" type="string"
> length="6" not-null="true"/>
>     <property name="Gemeente" column="gemeente" type="string"
> length="100" not-null="true"/>
>     <property name="Straat" column="straat" type="string" length="100"
> not-null="true"/>
>     <!--<property name="Geboortedatum" column="geboortedatum"
> type="DateTime" not-null="true"/>-->
>     <property name="Geslacht" column="geslacht" type="string"
> length="1" not-null="true"/>
>     <property name="Geboorteplaats" column="geboorteplaats"
> type="string" length="100" not-null="true"/>
>     <property name="Telefoon" column="telefoon" type="string"
> length="16" not-null="true"/>
>     <property name="Gsm" column="gsm" type="string" length="16" not-
> null="true"/>
>   </class>
> </hibernate-mapping>
>
> CLASS
> namespace DataTransfer
> {
>     public class user
>     {
>         private int id;
>         private int userTypeID;
>         private string voornaam;
>         private string familienaam;
>         private string gemeente;
>         private string postcode;
>         private string straat;
>         private DateTime geboortedatum;
>         private string geslacht;
>         private string geboorteplaats;
>         private string telefoon;
>         private string gsm;
>
>         public virtual int Id
>         {
>             get { return id; }
>             set { id = value; }
>         }
>
>         public virtual int UserTypeId
>         {
>             get { return userTypeID; }
>             set { userTypeID = value; }
>         }
>
>         public virtual string Voornaam
>         {
>             get { return voornaam; }
>             set { voornaam = value; }
>         }
>
>         public virtual string Familienaam
>         {
>             get { return familienaam; }
>             set { familienaam = value; }
>         }
>
>         public virtual string Gemeente
>         {
>             get { return gemeente; }
>             set { gemeente = value; }
>         }
>
>         public virtual string Postcode
>         {
>             get { return postcode; }
>             set { postcode = value; }
>         }
>
>         public virtual string Straat
>         {
>             get { return straat; }
>             set { straat = value; }
>         }
>
>         public virtual DateTime Geboortedatum
>         {
>             get { return geboortedatum; }
>             set { geboortedatum = value; }
>         }
>
>         public virtual string Geslacht
>         {
>             get { return geslacht; }
>             set { geslacht = value; }
>         }
>
>         public virtual string Geboorteplaats
>         {
>             get { return geboorteplaats; }
>             set { geboorteplaats = value; }
>         }
>
>         public virtual string Telefoon
>         {
>             get { return telefoon; }
>             set { telefoon = value; }
>         }
>
>         public virtual string Gsm
>         {
>             get { return gsm; }
>             set { gsm = value; }
>         }
>     }
>
>
>
> }

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