-->
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: columnDefinition default value ignored
PostPosted: Thu Apr 01, 2010 5:17 am 
Beginner
Beginner

Joined: Fri Nov 24, 2006 10:33 am
Posts: 42
Hi

I'm having trouble getting default column values to work via Hibernate. In the database, a column called 'PIDM' is defined as:

Code:
int(9) NOT NULL default '0'


If I use an SQL client (QueryBrowser) to insert a record-and dont provide a value for this column, the default value is used.

Using Hibernate/JPA, if I dont provide a value, I get the following exception:

Code:
Column 'PIDM' cannot be null


I've given the column this columnDefinition but still have the problem

Code:
@Column(columnDefinition="int(9) NOT NULL default '0'")


Can anyone tell me where I am going wrong please?


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.