File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Bank account numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Bank account numbers" Watch "Bank account numbers" New topic
Author

Bank account numbers

Meg Jolie
Greenhorn

Joined: Jul 03, 2009
Posts: 20
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

Joined: Oct 02, 2003
Posts: 11494
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
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

Joined: Jul 03, 2009
Posts: 20
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

Joined: Mar 09, 2009
Posts: 600
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Bank account numbers