Controlling database dependency

Controlling database dependency

Old forum URL: forums.lhotka.net/forums/t/4303.aspx


Angel posted on Wednesday, February 06, 2008

This is a general question.

How do you manage the database dependency in your projects.

For example, if you modify a database field, how do you find what clases are affected by this change?

If you use storeprecedures for any database access seems to be easy using a specific name convention or something similar but if you use embeded sql commands seems to be more dificult.

What are your best practices for this issue?

JoeFallon1 replied on Wednesday, February 06, 2008

I use embedded SQL and it is not a real problem at all.

I have separate classes for each database table. Each class contains the SQL statements used for that table. I code generate the CRUD methods plus some other basic methods that prove useful. Then I inherit from that class and hand write any other SQL needed.

The point is that when I change a DB table by adding a field then I re-generate the CRUD class and then get compile errors on all the BOs that use it. I usually am able to just re-generate those BOs and the problem is solved. Sometimes I have to check the hand coded levels to ensure the new field does not affect them too.

Joe

 

Bowman74 replied on Wednesday, February 06, 2008

I'm with Joe on this one; use code generation.  When the database structure changes I refresh from the DB my and regenerate all my base classes and stored procs.  Any overrides and custom stored procs will have to be dealt with by hand, of course.  However, these tend to be outliers so there are not too many of them.

Thanks,

Kevin

Copyright (c) Marimer LLC