Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Representing types in creational db code
Joined: Feb 23, 2005
Feb 23, 2005 05:28:00
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.
Record r = new Record();
... populate fields
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
B&S: Record and Contractor classes
[B&S] Create Method
Exceptions in URLyBird
Capture list of checked rows from JSP
how to delete the rows which are checked
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013