ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles_Magid" <Charles_Ma...@comcast.net>
Subject RE: Newbie question: execution, invocation, doit, getResults ...
Date Tue, 31 Jul 2007 20:13:04 GMT
Thank you Jeff that worked fine.  

 

-----Original Message-----
From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Tuesday, July 31, 2007 3:53 PM
To: user-java@ibatis.apache.org
Subject: Re: Newbie question: execution, invocation, doit, getResults ...

 

It depends.

 

If you are using one of the generated DAO classes, you can invoke the
generated "selectByExample" method.

 

If you are not using DAOs, then you do this:

 

List answer =
sqlMap.queryForList("table_namespace.abatorgenerated_selectByExample",
pite);

 

Where "table_namespace" is the value in the generated sqlmap.xml for the
table.

 

It's easier to use DAOs, but it doesn't look like you using them with the
example code below.

 

Jeff Butler



 

On 7/31/07, Charles_Magid <Charles_Magid@comcast.net> wrote: 

I am an Abator & IBatis newbie.  I'm trying to figure out how to invoke my
query given the criteria I have established.  In other words, what goes in 
the area labeled  "Fill in the blank" below?



               Reader reader =
Resources.getResourceAsReader("com/rbm/db/SqlMapConfig.xml");
               SqlMapClient sqlMap =
SqlMapClientBuilder.buildSqlMapClient(reader);
               try {
                       sqlMap.startTransaction();
                       PromotionitemtextExample pite = new
PromotionitemtextExample();

pite.createCriteria().andPromonetPromotionIdEqualTo(4);
                       Promotionitemtext pit = [Fill in the blank]
                       System.out.println(pit.toString());
                       sqlMap.commitTransaction ();
               } finally {
                       sqlMap.endTransaction();

               }

 


Mime
View raw message