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 iBatis annotation related questions
Date Thu, 18 Feb 2010 11:08:40 GMT
Hello,

   I am going to have a presentation about iBatis 3 at Czech JUG. I have a
3-year experience with iBatis-2 and now I am doing little research on what's
new in upcoming iBatis 3 release. Most of my expectations come from iBatis 3
Whitepaper at the iBatis Confluence site. Now I am testing the new version
and there are some things I didn't expect. I will be very pleased if anyone
capable could answer me following questions so that I may forward them to
the attendees of CZ JUG:

*  1) multilevel configuration*
      Firstly I thought that there would be a chance to override less
prioritized level of configuration. Meaning, that if I have SQL represented
in an @Select annotation and I create XML statement in mapper file with the
same name, this XML declaration will take over the annotation and will be
used instead. Reality is that iBatis will fail to start complaining about
duplicate declaration. As I discovered, I can use only one or the other way
- I can combine XML file with annotation based Java DAO, but they must not
overlap in the sense of statement declaration. Is that right? Why is that
done this way?
      Next I thought there could be some means to explicitly say, that some
parts of the lower configuration level fit for me and therefore ease my life
a little. Let say I have ResultMap statement in XML configuration and 95% of
its properties is fine by convention, but I need only to specify more single
property or declare association / collection mapping. In that case I have to
state all properties in order to alter the single one that is needed to be
extra taken care of (or at least these are my findings from the tests I
wrote). What I really want to say is: use convention to all properties
except those that I explicitly configure in XML - that is not possible, is
it?

*  2) annotations*
      Another unpleasant surprise was, that I am not able to get along with
annotations to specify <collection> mapping - annotation @Collection is
missing. Also @Association is not present - but as I discovered, it's
possible to write @Result annotations in the way that associated object gets
mapped. In documentation I found a statement, that annotations in Java
aren't powerfull enough to make some things possible, but I can't make up
why @Collection annotation is not possible to be made.

*  3) combination of XML and annotations*
      I tried combination of XML and annotations (due to lack of @Collection
annotation) to specify @Select annotation but specify output as a ResultMap
mapping in the XML configuration. But that's not possible too. Mixing
configuration from annotations and XML is not possible in any way I guess.
Ok, but is there any way how to reuse my annotations, to get the same
behaviour as reusing ResultMap mapping in different statements of XML
configuration?!

*  4) automatic SQL implementation*
      I didn't find any piece of this functionality. May I take it, that
this was completely discarded?

*  5) annotations and dynamic SQL*
      Finally I didn't find any clue how to use dynamic SQL in annotations.
Does that mean that @SelectProviders are the only way how to make dynamic
queries by the Java code?

   Thanks for your time and answers I can use in my presentation if anyone
asks. Please, don't be offended by my questions, generally I think iBatis is
a great DAO framework.

Cheers Jan

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

Mime
View raw message