This week's book giveaways are in the Cloud and AI/ML forums. We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line! See this thread and this one for details.
So I have a program I made for summer camps created in java swing that assigns campers to cabins, prints lists and medical reports.
I'm working on a web application to assign activities, and over the next couple years, I hope to have it be an all out registration and camp management service.
Right now, there is no database linked, but the objects are just saved to a file.
So, I created an int variable for each class (Camper, Counselor, Cabin, CampInformation). However, I don't want to assign a number to it until it gets sent over to the database after the user saves it and links to it.
So, what I wanted to do, is when they link to the database, it enters the objects not found into the tables, and then it assigns a camper number, cabin number, etc. After it assigns a primary key, I want it to send back that key to the object in an ArrayList.
So, a couple ideas I had since int cannot be null are...
I would either just make all int variables 0 from the start, and loop through the ArrayList when saving the objects. For all objects where the int equals 0, it will store them in the database, and then it will take that key from the database, and assign the int to it. If it is not 0, it verifies the information in the database is the same, and if not, it will change each individual variable that has changed from the previous time.
The other idea I had was changing it to Integer and putting them in as null values, but doing essentially the same thing. Would both ideas work? Would one be better than the other? Or is it that I'm very confusing here and nobody knows what the hell I'm talking about?