General question regarding Java, Jpanel, and SQL and preferred method of interacting between them all
Please be patient with me as I attempt to assemble my question.
Let's assume I have a table that has three fields in it. Two of the fields are strings, and the third field is a integer. In the Java world when setting up your jpanel and your fields, do most programmers setup that integer field as a string on the screen, then convert it to a number under the covers before writing it to a table via sql? Or do they typically leave them as an numeric(integer) field on the screen? Additionally, is the preferred method to assign the sql field values equal to the jfield values, or is it preferred to define a group of variables that the jfield information is moved into, and then move the variables into the SQL fields? I am just trying to get a feel for the best method to achieve these things.
Additionally, if numbers are not typed in to a numeric(INT) field, then do we want to store NULL values to that field in that table, or is it preferred we store the value 0?
I hope all of that made sense. I am new to the java world, but hardly new to programming. I appreciate your patience, and thanks for taking the time to read through this.
Re: General question regarding Java, Jpanel, and SQL and preferred method of interacting between them all
I would suggest to have as an integer. For storing it in DB unless it is a mandatory to be stored i wouldn't store it. If its mandatory prefer to store zero instead of NULL.