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.  [ 2 posts ] 
Author Message
 Post subject: "identifier type mismatch"
PostPosted: Fri Jan 05, 2007 10:47 am 
Newbie

Joined: Mon Jun 05, 2006 4:53 pm
Posts: 4
Having trouble with a stubborn problem loading some objects from the database, and can't see where I'm going wrong. When I perform the load call, I get a thrown exception: "identifier type mismatch" "id".



From the mapping file:
Code:
    <id name="IntervalId" column="interval_id" type="Int32">
      <generator class="native" />
    </id>



And where used:
Code:
        Public Function load(ByVal inType As System.Type, ByVal inPK As Long) As Object

            Dim session As ISession = Nothing
            Dim loadedObj As Object

            session = m_sessionFactory.OpenSession
            loadedObj = session.Load(inType, inPK)

            session.Close()

            Return loadedObj

        End Function


In the database (MS Access) the column is an AutoNumber.

Where have I gone wrong?


Actually, looking at it I changed the inPK parameter to an Integer, and the load function works. Is the Integer sufficient for an AutoNumber column, or do I need a Long? If I declare the id as an Int64 instead of an Int32, will that work with the Long? I don't see anything mapped to a Long type in the documentation here:
http://nhibernate.sourceforge.net/nh-do ... ping-types

Like I said, I have it working now, so at this point, I am just trying to get a better understanding of it. Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 06, 2007 1:08 am 
Regular
Regular

Joined: Tue Feb 21, 2006 9:50 am
Posts: 107
It's a long time ago since i last worked with Access but if i remember right an 'AutoNumber' field maps to a long. So mapping the PK column to an Int64 will be fine as 'long' corresponds to 'Int64'.

Regards
Klaus


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