-->
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: German Float style!!
PostPosted: Fri Dec 23, 2005 3:38 am 
Newbie

Joined: Mon Nov 07, 2005 9:10 am
Posts: 3
Hibernate version:

hibernate 3.0

Hallo HTechies,

We have a problem of entering float values in German format. (i.e comma is used inplace of dot or point ex: 12,34 means 12.34). We are using hibernate as ORM with postgresql database, and JSF(Myfaces),our insertion of float numbers in German style, ends with the message "Conversion error". even used locale property of <x:inputText> tag. Actually Does hibernate support I18N, if so how...if you have any idea of getting through this... (but not manually editing the pojo classes generated by hibernate) , kindly share with the forum..

Danke im voraus

Satishhhh..


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 5:41 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Hello,
I do not think that this is a Hibernate problem but more a problem in your application.
As far as I know numbers have to have a dot notation and not a german comma. So if the user inputs a comma you have to convert this using java from string to a number.

Regards
Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject: German Float format..!!
PostPosted: Thu Jan 05, 2006 5:55 am 
Newbie

Joined: Mon Nov 07, 2005 9:10 am
Posts: 3
hi Laliluna,

At first thankyou for the reply and I wish u a happy new year 2006. und zwar wir habe die folgende problem gelöscht.

we parsed it using Numberformat class of java.text package at the time of inserting float value into database

Code:
new Float((NumberFormat
                    .getNumberInstance(new Locale(           
                            getUserLanguage())).parse(floatinput)).floatValue())


and we reformated at the time of presenting to user by

Code:
NumberFormat.getNumberInstance(
                    new Locale(getUserLanguage())).format(
                    new Float(floatinput.toString()))


hope we find still better solution in the future for entering German float style values...

cheers,

People are always blaming their circumstances for what they are. I don't believe in circumstances. The people who get on in this world are the people who get up and look for the circumstances they want, and, if they can't find them, make them.
- George Bernard Shaw


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.