It is telling you that FirstName contains string data rather than an Int32.
John Davidson On Thu, Aug 26, 2010 at 4:40 PM, Koen Verheyen <[email protected]>wrote: > I was wrong in my initial post. The property name is "StoreNumber" > which is mapped as Id. The column name is Firstname (don't ask, > legacy...). > > Hope that takes the ambiguity away... > > tnx > > On Aug 26, 10:36 pm, MattO <[email protected]> wrote: > > Can you provide details on the StoreId column? The error indicates it > > someone exists in your code or hbm files, but it is not shown in any > > of the classes or hbm files you've added to this post. > > > > On Aug 26, 3:33 pm, Koen Verheyen <[email protected]> wrote: > > > > > > > > > > > > > > > > > Hi, > > > > > The scenario is a batch job that imports data from lotus notes (the > > > master data store) and updates a sql table. I know NHibernate is not > > > ideal for batch processing, but it is not a large batch anyway and I > > > don't like setting up an alternative data layer just for this. Btw, > > > most of the time nothing is updated which means in NHibernate terms > > > that no updates are sent to the destination database. > > > > > The property is actually named StoreNumber instead of StoreId as you > > > can see (and yes it is mapped to a column "FirstName", bloody legacy > > > (<= that explains the why-lotus-notes)). It is not even an id in lotus > > > notes, but it is unique so we can use it as id. I have the same > > > problem comparing the dates obviouly. Stores is not a table but a view > > > but I guess that would be transparent. > > > > > Here's the mapping file: > > > <?xml version="1.0" encoding="utf-8" ?> > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > > > namespace="abcd.Entities.StoresImport" assembly="abcd"> > > > <class name="StoreImport" table="Stores"> > > > <id name="StoreNumber" column="FirstName" type="int"> > > > <generator class="assigned" /> > > > </id> > > > <property name="WarehouseShortName" column="DC" type="string" > > > not-null="true" /> > > > <property name="Name" column="LastName" type="string" > > > length="254" not-null="true" /> > > > <property name="OpenDate" type="datetime" /> > > > <property name="CloseDate" type="datetime" /> > > > <property name="IPAddress" column="PCIP" type="string" > > > length="254"/> > > > </class> > > > </hibernate-mapping> > > > This is the entity class: > > > using System; > > > namespace abcd.Entities.StoresImport > > > { > > > public class StoreImport > > > { > > > public virtual string WarehouseShortName { get; set; } > > > public virtual int StoreNumber { get; set; } > > > public virtual string Name { get; set; } > > > public virtual DateTime? OpenDate { get; set; } > > > public virtual DateTime? CloseDate { get; set; } > > > public virtual string IPAddress { get; set; } > > > }} > > > > > Br's > > > Koen > > > > > On Aug 26, 8:59 pm, MattO <[email protected]> wrote: > > > > > > When you changed some of the values from int to string did you > > > > accidently change StoreId to string as well? > > > > > > Can you attach your HBM xml file or fluent code? > > > > > > Can you attach your entity that has all the virtual fields assigned? > > > > > > Also, why are you trying to connect to lotus notes in the first place > > > > (didn't think people still used that, joking :-) )? Is this a > > > > continuous data pull your doing, describe your scenario as this seems > > > > like one of those cases where it might be better to not use > nHibernate > > > > and do some other type of integration such as SSIS (sql server > > > > integration services). > > > > > > On Aug 26, 10:38 am, Koen Verheyen <[email protected]> wrote: > > > > > > > I have to import data from a Lotus Notes database via ODBC. The > source > > > > > data are all varchar fields while some columns actually contain > dates > > > > > and numbers. I mapped those colums with NHibernate to the > appropriate > > > > > types which works for loading but not for comparing (using > criteria, > > > > > e.g. Restrictions.Eq("StoreId", 123)). > > > > > > > Whenever I execute that I get the OdbcException: [Lotus][ODBC Lotus > > > > > Notes]Incompatible data types in comparison > > > > > > > If I use a string value in the comparison I get an NHibernate > > > > > QueryException: StoreId expected type System.Int32, actual type > > > > > System.String > > > > > > > I have tried the same scenario with a SQL Server 2005 database with > > > > > varchar columns through an ODBC connection and the comparison > actually > > > > > works there. > > > > > > > NHibernate appears to send the value through an OdbcParameter > because > > > > > there's a question mark in the generated SQL query. I use the > > > > > GenericDialect and NotesSQL ODBC driver version 3.02. > > > > > > > Who can help please? > > > > > Thanks- Hide quoted text - > > > > > - Show quoted text - > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
