Archive for 04月 19th, 2009

MYSQL 外键定义

Apr 19 2009 Published by Tony under MySql

MYSQL 外键定义
建立外键的前提: 本表的列必须与外键类型相同(外键必须是外表主键)。
外键作用: 使两张表形成关联,外键只能引用外表中的列的值!
指定主键关键字: foreign key(列名)
引用外键关键字: references <外键表名>(外键列名)
事件触发限制: on delete和on update ,
可设参数cascade(跟随外键改动),
restrict(限制外表中的外键改动),
set Null(设空值),
set Default(设默认值),
[默认]no action
例如: outTable表 主键 id 类型 int
创建含有外键的表:

CREATE TABLE temp(
id int,
name char(20),
FOREIGN KEY(id) REFERENCES outTable(id) ON DELETE cascade ON UPDATE cascade
);

说明:把id列 设为外键 参照外表outTable的id列 当外键的值删除 本表中对应的列筛除 当外键的值改变 本表中对应的列值改变。

No responses yet

Spring Framework’s Building Blocks

Apr 19 2009 Published by Tony under Java

Spring Framework’s Building Blocks
     Spring is an application framework wand is divided into several modules or components. Each module provides a specified set of functionality and works more or less independently of the others.Needless to say,these modules can be leveraged to build scalable yet flexible enterprise Java applications.This system is very flexible,because developers can choose to use only the module that is most appropriate in the context of a problem.For example,a developer can just use the Spring DAO module and build the rest of the application with non-Spring components.Moreover,Spring provides integration points ot work with other frameworks and APIs.If you think Spring is unsuitable in aparticular scenario,you can use alternatives.In case the development team is more proficient in Struts,for example,it can be used instead of Spring MVC while the rest of the application uses Spring components and features such as JDBC and transactions.In the two scenarios described here,the developers need not deploy the entire Spring Framework.They will require only the relevant module along with the pring IOC container and the Struts libraries.

No responses yet