Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Strings fields to base type when using a VO

 
Marcelo Camargo
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a VO to exchange information from the server (business layer) and the client over network.

But, in the server, when I need to create a array list of the VOs, I am converting the database strings for each field in its base type to store in VO. And, when converting the rate string (currency) to a Float wrapper type, I need to care about localization, because in the database, the rates are stored as "$450.80" for example, and this are the US currency format.

My Vo has this variable:



But I don't know what to do at this point... Someone have a solution?

Other way I thought is just don't convert the database strings to its base types, and my VO could have strings as fields too. Maybe this be the way...

I would appreciate some comments.

Thanks,
Marcelo.
 
Marcelo Camargo
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I took the folowing solution: I create the VO using strings as the fields, because this way I dont need to check for the field integrity.
My would be creating an aditional problem to me doing that.

So, now its more simple and easy to understand.

Marcelo.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!