-->
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: A question / may be sugestion for the hibernate framework
PostPosted: Tue Dec 16, 2003 9:22 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 8:27 am
Posts: 36
Team,

I faced a problem and i do have a solution for it, but i was wanting to understand as to why the hibernate code is written the way it is.

The problem is i have a mapping where i have a space in the column declaration.
Code:
.....
<property name="corporationId" type="java.lang.Integer" column="CORPORATION_ID "  />
....

Now what happens is i will get the error that "JDBC error , column name not found...". However when i turn the trace on and get the exact sql from the command line and run the same in some tool, then the sql will work just fine.

Here is the code for the Integer value Type from hibernate.
Code:
public class IntegerType extends PrimitiveType implements DiscriminatorType, VersionType {
   
   private static final Integer ZERO = new Integer(0);
   
   public Object get(ResultSet rs, String name) throws SQLException {
      return new Integer(rs.getInt(name));
   }
....


This is the code that will generate the jdbc error above.

Now would it not help id we had the method like this

Code:
...
   public Object get(ResultSet rs, String name) throws SQLException {
      return new Integer(rs.getInt(name.trim()));
   }
....


Or even better to have a trim() done before it even comes to this method. In fact for all the types in the
Code:
package  net.sf.hibernate.type


This is just a sugesstion and there may be perfectly valid reason to do what has been done.

Please do excuse my understanding if it is not proper and also feel free to point out the mistake i have made if any.

Thanks for your wonderfull product.

Regards
Suchak Jani


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 1:53 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 8:27 am
Posts: 36
Team,

I know most of you are very busy, but i did want to get a insight into the above issue...

Thanks in Advance

Regards
Suchak Jani


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 3:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I don't understand. Why do you have a space? Why not just remove the space?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 5:49 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 8:27 am
Posts: 36
Gavin,

I did exactly that and it is working fine.

The only thing i wanted to understand is "is there a specific reason fro not having a trim() in the above class and related classes?"

Again, Thanks for your wonderfull product.

Regards
Suchak Jani


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.