If you're in an environment where you find it necessary to keep the configuration
of database resources in a centralized location, such as a fixed file path, then you
should still keep the mapping files on the classpath. That is, use a hybrid
approach where SqlMapConfig.xml is at the fixed file location but the mapping
files are still on the classpath. For example, consider the following structure:
Even though SqlMapConfig.xml is at a fixed location, internally it can still refer to
the XML mapping files on the classpath. This keeps most of your resources where
you want them, and reduces the chance of having inappropriate mapping files
deployed with your application.
Keep your files together
Keep your mapping files together; avoid spreading them out through your class-
path. Don't attempt to organize them beside the classes that they work with or
into separate packages. Doing so will complicate your configuration and make it
difficult to get an idea of what mapping files are available. The internal structure
inside the mapping files themselves makes further categorization is unnecessary.
Use smart filenames and keep the XML files in a single directory by themselves.
Try to avoid keeping classes in the same directory (i.e., package), and of course
don't mix them with other XML files!
This approach makes it easier to navigate your mapping files and the project in
general. It makes no difference to the i BATIS framework where you put your files,
but it will make a difference to your fellow developers.
Search WWH ::