I think I couldn't explain what the problem is. For example i have a class as below
Code:
public class Student
{
private int id;
private String name;
private String department;
...
}
Student's department attribute can be "Math", "Physics", "Computer Science" etc. Just one of them. But in the database I want to hold the department as an integer. For example
Code:
id| name | department(int)
--|---------|-----------
1 | justin | 2
2 | george | 1
3 | michael | 1
When i fetch a Student row from the database, I want to load the Student object's department field with string represantation which stores in another table named Department as below
s.id = 1
s.name = "george"
s.department = "Math" (not 1 or any other integer value)
Is it possible?