Home > iBATIS, Java Language, Spring > Spring + iBatis // Part 7 // Executing a Method

Spring + iBatis // Part 7 // Executing a Method

Ok, so you now have everything setup.  You have the libraries added, the database.properties file pointed properly, the applicationContext.xml file configured, the sql mappings file in place with the classes to support it, and the DAO interface implemented.

Now you just want to execute it and see it working, right?  The snippet below will execute the query to pull back a java.util.List.

public static void main(String[] args) {

ClassPathXmlApplicationContext ctx =
 new ClassPathXmlApplicationContext("applicationContext.xml");

MyDAO dao = (MyDAO) ctx.getBean("myDAO");
List<FilePickup> fp = dao.selectFilepickupInstructions();

for (FilePickup fps : fp) {
 System.out.println(fps);
}

ctx.close();

}

If you spot any errors, or have any questions about these steps, please feel free to leave a comment.  I can’t promise I will reply or have time to look into it.

Advertisement
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.