-->
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: Problem creating ID - primary key - Generator - identity
PostPosted: Thu Dec 11, 2003 6:16 pm 
Newbie

Joined: Wed Nov 26, 2003 1:27 pm
Posts: 9
Location: Overland Park KS
I'm trying to save a transient object like the following.

session.save(currentPersistenceObject);

xml-mapping :
-----------------
<class name="PersistenceObject" table="TRACTPRODUCERYEAR">

<id column="id" name="oid">
<generator class="identity"/>
</id>

<property name="fiscalYear" column="fiscalyear" type="java.lang.Short" not-null="true" length="4"/>
<property name="customerOid" column="customer_id" type="java.lang.Integer" not-null="true"/>
<property name="userName" column="last_changed_user" type="java.lang.String" not-null="true" length="50"/>

</class>

I encounter the following error:
Could not insert: Try to insert null into a non-nullable column in statement
[insert into TRACTPRODUCERYEAR (fiscalyear, customer_id, last_changed_user, id) values (2003, 19603, 'gn', null)]

The Dialect is
hibernate.dialect net.sf.hibernate.dialect.HSQLDialect.

Can some one please help me to understand what am I doing wrong here?

Thanks
Gowtham


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 6:59 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you use SchemaExport to generate your schema, then id is not your pb.

Try to remove not-null for each property to find the worong one.

_________________
Emmanuel


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.