Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Refactoring int constant's to use enums
vuthlarhi donald
Ranch Hand
Posts: 76
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
These is how the code is looking at the moment, I want to use
java
enums instead of constant's,
public class Course{ public static final int LEARNING_PROGRAMME_CATEGORY_NATIONAL_QUALIFICATION = 1; public static final int LEARNING_PROGRAMME_CATEGORY_PROVIDER_PROGRAMME = 2; /** * @persistent * @sqlnull */ private int learningProgrammeCategory; //Setters and getters }}
the first step that I did was to create an enum that looks like this
public enum LearningProgrammeCategory { National_Qualification(1), PROVIDER_PROGRAMME(2), AGENT_PROGRAMME(3), CAREER_BOOSTER(4), CAREER_STARTER(5), JOB_CREATOR(6), SELF_ENRICHMENT(7); private int learningProgrammeCategory; private LearningProgrammeCategory(int learningProgrammeCategory) { this.learningProgrammeCategory = learningProgrammeCategory; } public int getLearningProgrammeCategory(){ return learningProgrammeCategory; } }
...How do I save this enum to the database
Campbell Ritchie
Marshal
Posts: 79177
377
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Do you need to save that enum in a database at all?
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How are you saving the current int?
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Benefits of enum types
Please help me with the logic of the code!
switch on a string?
Use of enum
Coin Flipping Program!
More...