Hey,

I'm thinking of different ways to optimize my development cycle, which is
currently:
1. create domain object class
2. create mapper interface
3. create mapper xml
   -create result sets (though I usually just convert java's myProperty
notation to my_property in db)
   -create CRUD related operations (which, given my domain model, are pretty
much the same for each entity)

in quite a few cases, I find myself duplicating a lot of code in mapper
xmls. This makes it harder to maintain, and adding each new entity requires
additional xmls.

I had a few ideas on how to optimize that.
1. provide access to object metadata (class, method annotations,
reflectionion?) that can be used inside queries. This would allow me to
iterate through any number of properties, and generate quite a lot of sql
dynamically.
2. Extending one mapper xml from another. I imagine something like defining
my xxx.ProductMapper from xxx.ObjectMapper (which has CRUD and paging/search
operations defined), and just provide result sets and/or property lists in
the xxx.ProductMapper xml. This would work well with the extending of the
mapper interfaces (think abstract class - operations defined in base mapper,
with details specified in the extended one).
3. Parametrizing mapper xml files. Perhaps optional list of files to include
in the mapper xml, defined in the ibatis config file?

These are just ideas at the moment, but any of those things would make it
easier to write maintainable code, although a bit more complexity is
involved.


regards,
Andrius

ps. I am aware of the existence of the ibator, but I just don't like the
idea of the generated code, when the information can be retrieved at
runtime.

Reply via email to