-->
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.  [ 1 post ] 
Author Message
 Post subject: Having a second identity for a class. Possible?
PostPosted: Mon Feb 19, 2007 11:43 am 
Newbie

Joined: Mon Feb 19, 2007 11:36 am
Posts: 1
Hello,

I'm trying to map a class so it has second property of type int32 to be autogenerated. My class is mapped as follows:

<class name="MyClass, MyDomain">
<id name="Id" access="nosetter.camelcase-underscore" column="Id" type="Guid" unsaved-value="{00000000-0000-0000-0000-000000000000}">
<generator class="guid.comb" />
</id>
<version name="Version" access="nosetter.camelcase-underscore" type="Int64" unsaved-value="0" />
<property name="SystemNumber" access="nosetter.camelcase-underscore" type="Int32" not-null="true" unique="true" update="false" insert="false" />
....
other properties
....
</class>

I would like to have the SystemNumber autogenerated aswell, basicly, what I need is the MSSQL column property Identity set to 'true'. I can do this manually and it works fine, but I'm wondering if it's doable with mapping.
A composite key solution is not needed. I tried adding generator to the property, but naturally it was ignored.
I wont use SystemNumber as identifier anywhere with Hibernate, it's more of a human readable identity.
Any help is greatly appreciated.

Tomislav


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.