-->
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.  [ 3 posts ] 
Author Message
 Post subject: Curious missing characters problem
PostPosted: Tue Jul 21, 2009 5:00 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
I have a rather odd problem with a Pervasive SQL database; actually one column in particular:

The Customer_address table has a CHAR(10) type column 'Customer_no'

If I use JDBC direct to query this table, the standard ResultSet, rs.getString("Customer_no") method returns values like: 1DYN071, 1DYS072, 1POW091. These values are correct.

However, If I use hibernate (Customer_no is mapped to a String) to retrieve the same data I get values like: 1DYN71, 1DYS72, 1POW91. These values are incorrect.

Where has the '0' gone?

Other than this issue, the results returned by Hibernate appear to be correct.

Suggestions anyone - I'm at a loss as to how to proceed.


Top
 Profile  
 
 Post subject: Re: Curious missing characters problem
PostPosted: Wed Jul 22, 2009 5:13 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Hi all

I still don't have a solution to this - but I have been trying to track down the problem following is the output from the log files:

Code:
09:43:30,243 DEBUG SQL:401 - select this_."CUSTOMER_NO" as CUSTOMER1_8_0_, this_.ADDS_NO as ADDS2_8_0_, this_.NAME as NAME8_0_, this_.ADDS as ADDS8_0_, this_.ADDS_CODE as ADDS5_8_0_, this_.CONTACT_NAME as CONTACT6_8_0_, this_.POSTCODE as POSTCODE8_0_, this_.TELEPHONE_NO as TELEPHONE8_8_0_, this_.FAX_NO as FAX9_8_0_, this_.COUNTRY as COUNTRY8_0_, this_.VAT_DEL_TERMS as VAT11_8_0_, this_.VAT_NATURE_OF_TRANS as VAT12_8_0_, this_.VAT_MODE_OF_TRANSPOR as VAT13_8_0_, this_.INTRASTATS as INTRASTATS8_0_, this_.EC_SALES as EC15_8_0_, this_.PLANT as PLANT8_0_, this_.LOCATION as LOCATION8_0_ from CUSTOMER_ADDRESS this_
Hibernate: select this_."CUSTOMER_NO" as CUSTOMER1_8_0_, this_.ADDS_NO as ADDS2_8_0_, this_.NAME as NAME8_0_, this_.ADDS as ADDS8_0_, this_.ADDS_CODE as ADDS5_8_0_, this_.CONTACT_NAME as CONTACT6_8_0_, this_.POSTCODE as POSTCODE8_0_, this_.TELEPHONE_NO as TELEPHONE8_8_0_, this_.FAX_NO as FAX9_8_0_, this_.COUNTRY as COUNTRY8_0_, this_.VAT_DEL_TERMS as VAT11_8_0_, this_.VAT_NATURE_OF_TRANS as VAT12_8_0_, this_.VAT_MODE_OF_TRANSPOR as VAT13_8_0_, this_.INTRASTATS as INTRASTATS8_0_, this_.EC_SALES as EC15_8_0_, this_.PLANT as PLANT8_0_, this_.LOCATION as LOCATION8_0_ from CUSTOMER_ADDRESS this_
09:43:30,246 DEBUG AbstractBatcher:484 - preparing statement
09:43:30,284 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
09:43:30,285 DEBUG Loader:694 - processing result set
09:43:30,285 DEBUG Loader:699 - result set row: 0
09:43:30,288 DEBUG StringType:172 - returning '1DYN71    ' as column: CUSTOMER1_8_0_
09:43:30,288 DEBUG ShortType:172 - returning '0' as column: ADDS2_8_0_
09:43:30,292 DEBUG Loader:1173 - result row: EntityKey[com.nomogen.jobshop.hibernate.Customer_address#component[customer_no,adds_no]{adds_no=0, customer_no=1DYN71    }]
09:43:30,292 DEBUG Loader:1355 - Initializing object from ResultSet: [com.nomogen.jobshop.hibernate.Customer_address#component[customer_no,adds_no]{adds_no=0, customer_no=1DYN71    }]
09:43:30,297 DEBUG AbstractEntityPersister:2031 - Hydrating entity: [com.nomogen.jobshop.hibernate.Customer_address#component[customer_no,adds_no]{adds_no=0, customer_no=1DYN71    }]


The problem appears at line 09:43:30,288; the string value '1DYN71' should be '1DYN071'

I'm using V3.2.5GA but have also tested in 3.3.1 - no difference.

What I find odd is that org.hibernate.type.StringType does not have a line 172 - can someone tell me where this trace is being generated?


Top
 Profile  
 
 Post subject: Re: Curious missing characters problem
PostPosted: Wed Jul 22, 2009 7:33 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
OK - Problems solved - I feel stupid!
I've been working on a couple of versions of a database... my client had updated some fields without telling me!!
I was just comparing new/old data and thougth there was an error.
Damn


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