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: Impossible to use immutable properties in NH?
PostPosted: Tue Aug 29, 2006 9:14 am 
Newbie

Joined: Thu Aug 17, 2006 8:10 am
Posts: 3
I'm spent. I've looked everywhere (including the Hibernate reference material), but can't find anything on this.

I have the following mapping of a property
Code:
<property name="CaseNumber" type="Int32" update="false" insert="false">
<column name="CaseNumber" sql-type="int" not-null="false"/>
</property>


The database column "CaseNumber" is NOT the key in the table, but has an Identity seed (which means that the integer is counted up on every insert).

When I saves the object I don't give it any value (and since it's an int I guess that the uninitialized value is 0), and the insert to the database is done correctly. But when I then look at the value after the save, the value is of course still 0. Isn't there a way for me to get the value syncronized with the object?

Thanx


Top
 Profile  
 
 Post subject: Is this the correct way?
PostPosted: Tue Aug 29, 2006 10:18 am 
Newbie

Joined: Thu Aug 17, 2006 8:10 am
Posts: 3
I've solved it temporarly, by doing an ISession.Refresh(o) on the object after I've inserted it. Is this the way to go, or am I missing something?


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.