-->
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: identity column
PostPosted: Tue Oct 04, 2005 3:52 pm 
Newbie

Joined: Fri Jul 29, 2005 11:48 am
Posts: 11
I have a table with a Guid primary key, but I also need to automatically generate a unique int number for each row. I was thinking I can use an Identity for the column, but NHibernate keeps giving me a null exception. I tried using Int32 and NullableInt32 for the column and they both throw an exception. Please help me find a solution for this. Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 11:01 pm 
Newbie

Joined: Tue Sep 20, 2005 10:22 pm
Posts: 6
Hi,


I do something similar with a Created column which its defualt value is the function getdate().

Code:
<property name="ID" column="ID" type="Int32" update="false" insert="false" />


This tells Nhibernate to not persist the value of this property to the database but to only read it. Which should be exactly what you want if your using a MSSQL identity column.

Hope this helps!


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.