• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

item ID numbers

 
Nicholas Lefebvre
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to make a program that can aoutomaticaly create and asign a ID number to a new item but the ID number can not be repeated once. How would i do that the rest of the program is working i just need to genereate it.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on your id requirement, you can consider AtomicInteger, AtomicLong or UUID
 
Winston Gutkowski
Bartender
Pie
Posts: 9461
49
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nicholas Lefebvre wrote:I need to make a program that can aoutomaticaly create and asign a ID number to a new item but the ID number can not be repeated once. How would i do that the rest of the program is working i just need to genereate it.

My advice: Use a database.

Chances are that your Item will have to be stored somewhere anyway, so why not use the place where you're going to store it?

Winston
 
Nicholas Lefebvre
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know how to start setting up the database but i do know how to start the data base is access but MySQL and that i dont know.So could you tell me the steps involved.
 
egbai mmumene
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a java class containing the jdbc mysql class objects there you define your database name and password. but before that you need to download the plugin and extract it into your jar file library.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic