• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bank account numbers

 
Meg Jolie
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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!
 
fred rosenberger
lowercase baba
Bartender
Posts: 12083
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic