Chapter 5. Executing nonquery statements
This chapter covers
- More of the iBATIS API
- Inserting data
- Updating and deleting data
- Using stored procedures
Running a query over your database is definitely worthwhile, but most applications also need to get data into the database. In this chapter, we explore some of the ways to populate your database using the iBATIS framework. We build on the concepts introduced in chapter 4, so if you are new to iBATIS and have not read that chapter yet, you may want to take a quick look. Nearly all of the parameter-mapping information (and result-mapping information too, to a small extent) from chapter 4 will apply to nonquery mapped statements as well.
In chapter 4, you learned about all of the available statement types and the parts of the API relevant to basic queries. Here we look at the API that you will commonly use for executing nonquery statements, and review the mapped statement types for updating your database.
We save the topic of advanced ways to update your database for the next chapter, so for now, let’s stick to the basics of insert, update, and delete—the three methods that you will most often use to update your database. We cover each of these methods in more detail later in this chapter, but right now, we offer a brief introduction, which may be enough for you to get started using them.