-->
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: '' Field Value problem
PostPosted: Tue Dec 16, 2003 10:28 pm 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
I have some FK'd declared on the database level. I didn't tell Hibernate about them because I felt it would be cumbersome to make an object out of a table with a single string field. I just wanted referential integrity enforced by something and it seemed easiest to do it that way.

Problem is now that when I insert a (mostly blank) record, Hibernate will default the field to '' rather than NULL, thus causing a key violation exception.

It's trivial to add a '' record to the table the FK is based on, but it shouldn't be necessary I figure.

What's the right way to handle this?

_________________
"A statistician is a mathmetician, broken down by age and sex".


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 16, 2003 11:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Problem is now that when I insert a (mostly blank) record, Hibernate will default the field to '' rather than NULL


Of course, Hibernate does not do this.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 12:07 am 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
Thank you. I'm coming to that conclusion.

It's either BeanUtils.copyProperties or Struts itself. I know my code aint mentioning this property.

_________________
"A statistician is a mathmetician, broken down by age and sex".


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 1:14 am 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
gavin wrote:
Quote:
Problem is now that when I insert a (mostly blank) record, Hibernate will default the field to '' rather than NULL


Of course, Hibernate does not do this.


The nominees are Hibernate or Apache.

The envelope please....

http://issues.apache.org/bugzilla/show_bug.cgi?id=22371

I'm sorry for thinking it was you first :)

_________________
"A statistician is a mathmetician, broken down by age and sex".


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.