Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
11Activity
P. 1
Spring Framework Tutorial

Spring Framework Tutorial

Ratings: (0)|Views: 984 |Likes:
Published by api-3741100

More info:

Published by: api-3741100 on Oct 15, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

 
Spring Framework Tutorial
Isabelle Muszynski15 April 2003
 
Chapter 1
Introduction
This tutorial covers the main packages in the Spring Framework. For full details, we refer you to RodJohnson’s book, Expert One-on-One J2EE Design and Development, published by Wrox Press in 2002. Thebook’s ISBN number is 1-86100-784-1.The code for the Spring Framework is contained in package com.interface21. We provide UML diagramsfor the subpackages, as well as code samples.
1.1 Setting up for the samples
The samples have been written using the MySQL database (www.mysql.com), Tomcat (jakarta.apache.org/tomcat)and JBoss(www.jboss.org). We refer you to these web sites for setting up the environment correctly. InMySQL, create a database named test, a user test with password test, and grant user test all rights:
grant all on test.* to test@localhost identified by ’test’;
If you use a different database, read the comments at the top of the samples files, they will direct you tothe spots in the code you will have to change for your database.
1.2 Building the tutorials
The tutorials can be built using the provided Ant script (you can get ant at http://jakarta.apache.org/ant).You may need to edit the build.properties file to set paths correctly for your system.
1.3 Running the tutorials
We provide a shell script, runtest.sh, and a batch file, runtest.bat, for running a single tutorial. You mayneed to edit these files to set the paths correctly.1
 
Chapter 2
The JDBC Package
Data access is taken care of in the com.interface21.jdbc package and its subpackages. These packages arenon-intrusive, and so you can use them separately from the rest of the framework to implement persistencein your application.There are two main packages, com.interface21.jdbc.core, which implements low-level persistence, and thehigh-level com.interface21.jdbc.object, which presents an object-oriented view of the low-level package.
2.1 Exception Handling
Clients of the package - i.e. you, as the developer - should not have to concern themselves with SQLEx-ceptions, as these will not be very informative to your users. Also, because SQLExceptions are checkedexceptions, they have to be caught. The Spring Framework takes a different approach : checked SQLEx-ceptions are converted to unchecked DataAccessException and its subclasses. A number of pathologicalconditions are recognized, through the SQLExceptionTranslater interface and its implementing classes, andwill result in subclasses of DataAccessException being thrown. For example, a unique key integrity violationwill cause a DataIntegrityViolationException to be thrown. It is up to you, as the developer, to catch thisexception – if your code can recover from it – or not, thereby letting it percolate upwards.2

Activity (11)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
kunalcparikh liked this
findsoumya5 liked this
sathishsgr liked this
keen_learner007 liked this
genesis121212 liked this
Umang Bhatt liked this
spegonzo liked this
Pisoiupc liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->