I'm new to Programming and Java and building a small Application in JAVA with SQL and UI(Jframes)
In the log-in frame after the user enters his user name and password I do a SQL select query to search USER table for this user. If the query returns 1 single row, the login button event handler triggers and the object of the next frame is created.
few frames later I have an SQL insert activity where I also have to insert the USER_ID of the person initiating the insert(the current logged in user).
What is the best practice to pass this information across a series of frame classes?
My initial idea is to pass the user_id as a parameter in the object so it gets set in the constructor of each frame class. but the problem is not all my frames really need this data. Only the final frame involved with the insertion needs the user ID. but in-order to get to that frame I have to pass through all other frames. This doesn't seem like a good practice.