I really don't know if this is the best forum for this question but I couldn't think of any better place and since I am doing this in a Servlet....
Anyway, when I create a new Issue I have a field called status which is of a type IssueStatus. IssueStatus has 2 fields; id(Integer) and status(String). I have a database table (t_issue_status) with all the possible status' (Open, In Progress, Resolved).
My problem is simply the best way to do the following. When I click submit to create a new Issue, I need to set the Issue objects IssueStatus to Open. This is static as in every time a new Issue is created the status is Open. So I could do something like:
My main problem with this approach is maintence. What if down the road I wanted to change Open to something else. I don't want to have to dig back in the code. So my options are always pull this from the database, use some sort of properies file and load this file in a ContextListener, a combination of the 2. Use my Constants class and provide a public static final Integer OPEN_STATUS = 0.
1. A default value in the database. Where you don't have to provide anything since it will automatically be used when a new record is created.
2. JavaScript, have it add it in the client side.
3. Properties file that the Servlet( er helper class) reads to see the default, then you only have to change the properties file when it changes rather than code and recompiling and deploying.
I prefer the first, since there is no code, just db table structure.
Originally posted by Mark Spritzler: Well, I have two suggestions.
1. A default value in the database. Where you don't have to provide anything since it will automatically be used when a new record is created.
2. JavaScript, have it add it in the client side.
3. Properties file that the Servlet( er helper class) reads to see the default, then you only have to change the properties file when it changes rather than code and recompiling and deploying.
I prefer the first, since there is no code, just db table structure.