ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vic Cekvenich <...@friendvu.com>
Subject Re: Flexible ResultMaps (Again)
Date Sat, 05 Feb 2005 22:13:00 GMT
Huy wrote:

>
>
> I see what you mean but I need my domain objects because my apps are 
> used by different clients with different databases with different 
> schemas (similar but not exact; it's a legacy thing). The domain 
> objects help me to keep all my other layers independent of the 
> database schema. I know I can do "select column as blah" but I really 
> don't like doing this in all my selects (it could get error prone).
>
> I really do believe that resultmaps is required for my situation. I 
> just think it's a good idea to make it just that little bit more 
> flexible.
>
> . However, unless you can help me overcome the problem above, I can't 
> see how I can use it effectively.
>

So...  your domain object can be a Map, just like a bean, read 
http://groovy.codehaus.org/Quick+Start
Old:
class person { // at domain level, we do not know if this is one or 2 
tables, it's a logical enity; nothing phsycial
get/setName{}
get/setAddress{}
}

New:
Map person ....

person.get("name")
person.get("address")

SAME THING, you'll get used to it to have a collections for a domain.

Anytime you have a hard coded bean.. use a losley typed map. If you have 
to make a custom map... no big deal**. I learned to let go using 
actionscript, it was not easy.
The 2nd thing that helped me let go of beans is CoR (commons chains)... 
it allways uses Map as an argument.

**side benefit... if you need to add, remove coluns on view or sql... 
less code.

.V
(join us CB, the water is warm ;-) )
-- 
Forums, Boards, Blogs and News in RiA <http://www.boardVU.com>

Mime
View raw message