-->
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.  [ 5 posts ] 
Author Message
 Post subject: Null values
PostPosted: Tue Jan 27, 2004 5:03 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I'm using sybase ase 12.5 and I have a strange problem. I'm doing a

MyObj myObj = new MyObj();
myObj.setName("tim");

session.save(myObj);
transaction.commit();

(not verbatime)

On Oracle and MySQL, this works fine, but on sybase it complaints that the field "name" cannot be null. I have, of course, run it through the debugger and the "name" field on the object is certainly not null.

There is a constraint in the database that prevents the field from beeing null. When I remove it, it works fine.

Does Hibernate attempt to create an empty object in the DB first and then fill in the rest before commiting?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 5:21 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
I don't suspect so. You could confirm this though by enabling debugging. Please post the trace, your hibernate mapping files and the java code you are executing.


Top
 Profile  
 
 Post subject: Re: Null values
PostPosted: Tue Jan 27, 2004 8:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
nickvajberg wrote:
Does Hibernate attempt to create an empty object in the DB first and then fill in the rest before commiting?

Yes but only in this case AFAIK, and probably depending your id generator
Code:
MyObj myObj = new MyObj();

session.save(myObj);
myObj.setName("tim");
transaction.commit();

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 28, 2004 5:47 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I use the hilo generator


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 28, 2004 6:14 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I used the wrong driver... it works now!!! sorry guys.


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