I generate model classes using repository.xml as a template definition. In
addition to populating a collection of fields in a data object class I
generate a list of public static members that represent column names in DB.
It works really well providing a compile time check for a valid column name
as long as you specified the right one in repository.xml.

Max.

-----Original Message-----
From: Gary Eberhart [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 31, 2003 6:16 PM
To: OJB User Group (E-mail)
Subject: Hard Coded Column Names


Hello All,

When coding OJB queries you can code the following;

crit1.addLike("firstname", "%o%");
crit1.addLike("lastname", "%m%");


where firstname and lastname are the names of columns in the table.

If you where to change the name of a column you would not know your code was
broken until the query was run containing the invalid column name.

Does any one have a way of making this problem show up at compile time?

I was considering using constants stored in my model class.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to