• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Bank account numbers

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am creating a Bank application using JSP, struts, jdbc. What would be the best method to generate account numbers? Should account numbers be int or string? Thanks!
 
lowercase baba
Posts: 13082
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you going to use them? Will you need to do arithmetic on account numbers? Will an account number consist of parts like a branch number + ID where you'll need to pull them apart?

Generally speaking, I would suggest not thinking about what data type to force it into, but think about how you will use it now, and possibly in the future. Let those considerations determine how to store it.
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Meg:

I agree with Fred. In fact, it may be better to create a bank account type, so you can hide the implementation details.

John.
 
Meg Jolie
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies! I won't have to perform any arithmetic on the bank account numbers after they are generated. Would it be a good idea to generate each one using random number generator (and check for duplicates) or generate one account number and keep incrementing each of the other ones by 1? How do Banks do it? Thanks again..
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Meg:

I would guess that banks probably do it sequentially in some manner (maybe with blocks of numbers to each branch), since random account generation would have to deal with possible duplicates as you mentioned.

John.
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic