-->
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: could not instantiate id generator for strategy 'Identity'
PostPosted: Fri Dec 28, 2007 7:13 am 
Newbie

Joined: Fri Dec 28, 2007 6:52 am
Posts: 1
Hi all,

I had trouble adding a record to a table using a MSSQLSERVER2005. It generated the above error.

This was my hbm.xml code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BusinessLogic.MediumType, BusinessLogic" table="TypeOfMedium">
<id name="TypeOfMediumID" column="TypeOfMediumID" type="Int32" unsaved-value="0">
<generator class="Identity"/>
</id>
<property name="Code" column="TypeOfMediumCode"/>
<property name="Description" column="TypeOfMediumDesc"/>
</class>
</hibernate-mapping>

It didn't work. Then I changed it to:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BusinessLogic.MediumType, BusinessLogic" table="TypeOfMedium">
<id name="TypeOfMediumID" column="TypeOfMediumID" type="Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="Code" column="TypeOfMediumCode"/>
<property name="Description" column="TypeOfMediumDesc"/>
</class>
</hibernate-mapping>

and now it works just fine. Notice that I changed "Identity" to "identity".

Greetings
Dirk Van hoof


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.