-->
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: Insert into Oracle9i field larger than defined
PostPosted: Thu Jan 27, 2005 9:25 pm 
Beginner
Beginner

Joined: Mon Jan 24, 2005 6:42 pm
Posts: 26
Been digging for the answer to my problem for the past hour. Was trying to insert a row into a table. I have a field with a size CHAR(1), unknowingly was passing it 3 characters instead. Hibernate Insert was showing up on the debug screen but nothing in the DB. Finally, compared db fields to what I was passing and voilla, insert was successful.

There were NO exceptions thrown whatsoever. Does anyone have an explanation for this?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 9:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Some databases silently trim character data. Why do you believe that this would be Hibernate-specific??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 9:54 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
I don't think it has anything to do with Hibernate. It's probably the JDBC driver. I don't use Oracle, but tracing the problem in my hand is telling me that. If you want Hibernate to throw an exception, I suggest you specify the Hibernate type. To be honest, I've never used char(1) with Hiberante before (just with other applications). If you stored this is a string, I don't think Hibernate would know that the underlying type is really a single char. Perhaps use type="char" instead? That would add the necessary type checking. If you decided to use a string, I'm sure Hibernate would throw something in that case. Just experiment to find the answer really.

For me, I try and put all of my validation in the domain layer so this sort of stuff doesn't happen when it reaches the db.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 9:56 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
I meant to say trace the problem with my mind.
This board could use edits :/


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 6:07 pm 
Beginner
Beginner

Joined: Mon Jan 24, 2005 6:42 pm
Posts: 26
Gavin,

I copied generated sql into a sql editor and executed it against Oracle, I got an exception. Perhaps JDBC driver swallowed the error.

Is there a way to tell hibernate that a single character database column is of type Boolean?

Thanks


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.