img
Listing 11-1. log4j.properties File
log4j.rootCategory=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %40.40c:%4L - %m%n
Sample Data Model for Example Code
For the sample data model for the examples in this chapter, we will use the same model as presented in
Chapter 9, when we discussed using Hibernate with Spring, with some minor modifications. Figure 11-2
shows the sample data model.
Figure 11-2. Sample data model for MyBatis
The main difference between this model and the one in Chapter 9 is that the VERSION column of the
CONTACT and CONTACT_TEL_DETAIL tables are removed. The main reason for this is that MyBatis doesn't
provide optimistic locking support with the VERSION column like Hibernate does. However, you will be
able to see in the sample application how to implement optimistic locking using MyBatis.
Listings 11-2 and 11-3 show the scripts for schema creation (schema.sql) and sample data
population (test-data.sql), respectively.
Listing 11-2. Sample Data Model Creation Script
CREATE TABLE CONTACT (
ID INT NOT NULL AUTO_INCREMENT
, FIRST_NAME VARCHAR(60) NOT NULL
, LAST_NAME VARCHAR(40) NOT NULL
, BIRTH_DATE DATE
, UNIQUE UQ_CONTACT_1 (FIRST_NAME, LAST_NAME)
, PRIMARY KEY (ID)
);
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home