-->
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.  [ 4 posts ] 
Author Message
 Post subject: Fail to create a new instance using native generator
PostPosted: Sun Apr 18, 2004 5:26 pm 
Beginner
Beginner

Joined: Thu Mar 25, 2004 9:13 am
Posts: 20
Hi there, I am creating a new instance using hibernate 2.1. with SQL server 2000. I am using the
Code:
native
generator to maintain cross-platform. Here is the relevant xml part...

Code:
<class name="com.snap.businessobjects.network.Network" table="SSN_NETWORKS">
        <id name="id" type="long" column="NET_ID" unsaved-value="0">
            <generator class="native"/>
        </id>


ASAIU from the documentation there is nothing else I should provide. I am getting the following error:
Code:
01:18:29,763 ERROR [JDBCExceptionReporter] could not insert: [com.snap.businesso
bjects.network.Network]
java.sql.SQLException: Cannot insert the value NULL into column 'NET_ID', table
'snap.dbo.SSN_NETWORKS'; column does not allow nulls. INSERT fails.


According to the documentation, since I am using SQL Server 2000 Hibernate should be using the
Code:
identity
generator which does not require any tables or parameters.

Any ideas?

_________________
Oren Gross


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 18, 2004 7:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Have you defined your column properly as identity column?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 18, 2004 11:44 pm 
Beginner
Beginner

Joined: Thu Mar 25, 2004 9:13 am
Posts: 20
mmm.... I am not sure what that means - so I guess I didn't (first hibernate code). Can you elaborate or point me to the docs?

Thanks

_________________
Oren Gross


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 3:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The id column must be of identity type in your database.


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