ZKTM Small Talks

ZK with Spring DAO and JDBC

Simply Rich

Home / Small Talks

Andrew Ho
Principal Engineer
Potix Corporation
Jun 8, 2006

Version 2.1.1 or later: Use the org.zkoss package instead of the com.potix package.

The ZK is the best way to develop your web's user interface. The Spring Framework is the leading full-stack Java/J2EE application framework. Spring framework delivers significant benefits for many projects, reducing development effort and costs while improving test coverage and quality. We give you an brief introduction to bring Spring DAOs and JDBC into your web application. With the Spring framework, you are easy to persistent your data into your database.

The sample project use the eclipse as programming environment and the Tomcat is the web server. The MySQL is the database system to store data. You can see "Develop ZK Applications with Eclipse" to know how to setup the developing environment.

Install Spring

Tomcat 5.5 and JDBC Setting

Spring and JDBC

Spring DAO and JdbcTemplate

Spring Transaction

        1. PROPAGATION_REQUIRED - Support a current transaction, create a new one if none exists. This is the most common choice.
        2. PROPAGATION_SUPPORTS - Support a current transaction, execute non-transactionally if none exists.
        3. PROPAGATION_MANDATORY - Support a current transaction, throw an exception if none exists.
        4. PROPAGATION_REQUIRES_NEW - Create a new transaction, suspend the current transaction if one exists.
        5. PROPAGATION_NOT_SUPPORTED - Execute non-transactionally, suspend the current transaction if one exists.
        6. PROPAGATION_NEVER - Execute non-transactionally, throw an exception if a transaction exists.
        7. PROPAGATION_NESTED - Execute within a nested transaction if a current transaction exists, otherwise behave like PROPAGATION_REQUIRED.
        1. ISOLATION_DEFAULT - Use the default isolation level of the underlying datastore.
        2. ISOLATION_READ_COMMITTED - Indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.
        3. ISOLATION_READ_UNCOMMITTEDL - Indicating that dirty reads, non-repeatable reads and phantom reads can occur.
        4. ISOLATION_REPEATABLE_READ - Indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.
        5. ISOLATION_SERIALIZABLE - Indicating that dirty reads, non-repeatable reads and phantom reads are prevented.

ZK with Spring DAO

Sample

Reference

  1. Develop ZK Applications with Eclipse
  2. Spring in Action by Craig Walls and Ryan Breidenbach, see Chap. 1 ~ 5
  3. Spring DAO with JDBC, Eclipse, PostgreSQL, MySql


Copyright © Potix. This article is licensed under the Creative Commons Attribution 2.5 license.

SourceForge.net Logo