ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ing. Jan Novotný <novotn...@gmail.com>
Subject Re: Using auto-discovery for ibatis3 configuration - works great, less XML
Date Mon, 26 Apr 2010 15:16:17 GMT
Sounds very interesting - at least I am interested because we use the same
combination of iBatis and Stripes  in our company. Could you make you
sources accessible somewhere - possibly on iBatis Confluence site? Thank you
in advance.

Regards,
Jan

2010/4/26 Larry Meadors <larry.meadors@gmail.com>

> I spent the weekend exploring how to use convention-based
> configuration with ibatis3 on a new project I'm working on.
>
> Open source is great, so I lifted the Stripes ResolverUtil class to
> assist me in finding classes that I then wired into my ibatis
> configuration at startup.
>
> For example:
>  - I have all of my beans in one package, so I create type aliases for
> all of them: "blah.blah.Order" becomes "Order"
>  - I have all of my type handlers in one package, so I register (or
> alias) them the same way (more on this in a bit)
>  - I have all of my mapper interfaces in one package, so I register
> all of them the same way
>
> My current configuration eliminates the main XML configuration file,
> and I also put the SQL map XML files in the same packages as the
> mapper interfaces, so registering the interface loads the XML SQL
> maps, too.
>
> One thing I did have to add is a @MappedType(class[]) annotation for
> my type handlers - this allows me to control if I want to have my type
> handlers registered globally or just aliased - without the annotation,
> they are just aliased (so "blah.blah.OrderHandler" becomes
> "OrderHandler" - simpler to use in the XML files). With the the
> annotation, I register it globally for the types listed.
>
> If folks are interested in seeing more on this, I can put together a
> simple example app that does it (or help someone out if they want it
> sooner).
>
> Anyone?
>
> Larry
>
>
> PS:
>
> This may be more appropriate on the dev list, but since Stripes is
> distributed under ASL2, I could even add this to the core - it's one
> new class, and we could extend the configuration API to have these
> kinds of methods:
>  - typeHandlerRegistry.registerPackage(String packageName);
>  - configuration.addMapperPackage(String packageName)
>  - typeAliasRegistry.registerAliases(String packageName);
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>


-- 
--------------------------------------------------------------
Ing. Jan Novotný
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
http://blog.novoj.net
Myšlenky dne otce Fura
--------------------------------------------------------------

Mime
View raw message