ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lamey <cla...@localmatters.com>
Subject Re: SQLMap validation at startup?
Date Tue, 05 Sep 2006 19:13:44 GMT
I second Larry's motion encouraging you to unit test.

You can avoid the long
build/deploy/webapp-init/login-to-app/browse/cause-error loop by testing
after the build step.  Eclipse and IntelliJ both have a button to run a
JUnit test, so that's just a single 'Run as JUnit Test' step.  And if
you're using Emacs or gvim or pico, you should have an ant task called
'test' that takes a test name wildcard so you can do something like 'ant
test -Dtest.src.include=com.foo.moo.CustomerTest*'.

It sounds like you're using Spring's WebApplicationContext via web.xml,
so you'll need to init Spring for your tests another way.  There are
several different ways to do this, take a look at the JUnit and Spring
docs for examples.

Cheers,
Chris

On Tue, 2006-09-05 at 12:34 -0600, Larry Meadors wrote:
> Because it can't.
> 
> How would it do it with something like this:
> 
> select orderId, qty, price, qty*price as extendedPrice from ...
> 
> It would have to (a) execute the SQL, or (b) parse the SQL.
> 
> But it gets better!
> 
> How would it do it with something like this:
> 
> select
>   orderId,
>   qty,
>   price,
>   <isNotNull property="showExtPrice">qty*price as extendedPrice</isNotNull>
> from ...
> 
> Bottom line is that what you are asking for is not really possible
> unless you can satisfy yourself with your integration tests.
> 
> Larry
> 
> 
> On 9/5/06, Matthew Hixson <mhixson@activerain.com> wrote:
> > We are using Spring.  What I mean is that if I have this in a SQLMap:
> >
> > <result property="decisionFlag" column="decisionFlag"/>
> >
> > it would be nice to have iBatis take a look at the database and tell
> > me that there really is no column named decisionFlag in this business
> > object (the real column name is decision_flag).  Right now it only
> > tells me that the first time I access the object.
> >    -M@
> >
> > On Sep 5, 2006, at 9:24 AM, Christopher.Mathrusse@sybase.com wrote:
> >
> > > If you use Spring all SQL Maps get loaded and validated at startup.
> > >
> > > From: Matthew Hixson <mhixson@activerain.com> [mailto:Matthew
> > > Hixson <mhixson@activerain.com>]
> > > Sent: Friday, September 01, 2006 5:22 PM
> > > To: user-java@ibatis.apache.org
> > > Subject: SQLMap validation at startup?
> > >
> > > Was wondering if there was any way to get iBatis to validate that all
> > > of the SQLMaps are sane at startup time instead of whenever a
> > > business object is used. What I want to do is prevent having to run
> > > through the code/deploy/login to webapp/test/get exception process 3
> > > times when I have 3 typos in my SQLMaps.
> > >
> > > Not that I'm bitter.
> > >
> > > -M@
> > >
> >
> >

Mime
View raw message