| Author |
Representing types in creational db code
|
Horatio Westock
Ranch Hand
Joined: Feb 23, 2005
Posts: 221
|
|
I'm looking for wisdom on the following situation. I have a fairly standard situation where one table in the database references another, with the latter table representing a set of type values. I have DAOs representing records from both tables, and I'm trying to work out the best way of using the types in a creational sense. For example, Record r = new Record(); ... populate fields recordDAO.insert(r); Now, in my business logic, there may be a requirement to create records of a certain type. For example, r.setType( Type.getByUID( Type.STANDARD_TYPE ) ); As you can see, at the moment I am using some enumerated fields in Type DAO to correlate to unique values in the underlying table. These are guaranteed unique character identifiers. This doesn't feel right. Of course I can factor out the UIDs to a configuration file, but this doesn't change the fact that the code still needs to know how to create a "STANDARD_TYPE". Any suggestions of a better approach to this, without changing my current persistance layer entirely?
|
 |
 |
|
|
subject: Representing types in creational db code
|
|
|