- 浏览: 608863 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
oldrat:
引用Special cases aren't special ...
武汉大学开源技术俱乐部 技术交流 第1期 -
yzsunlight:
试了试 ,不行
Android Studio SDK Manager无法正常下载如何设置 -
qianjigui:
更全面的文档:http://www.5wpc.info/it/ ...
Ruby正则表达式操作参考 -
qianjigui:
Anddy 写道Anddy 写道tag是自动创建的吗? 能手动 ...
vim的跳转 -
Anddy:
Anddy 写道tag是自动创建的吗? 能手动创建吗? 在sh ...
vim的跳转
我的环境配置
Mysql :server version: 5.0.45-Debian_1ubuntu3.1-log Debian etch distribution
Spring frame: 2.0
jdk 1.6
数据库的配置:
--
MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version 5.0.45-Debian_1ubuntu3.1-log
/**/ /* !40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */ ;
/**/ /* !40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */ ;
/**/ /* !40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */ ;
/**/ /* !40101 SET NAMES utf8 */ ;
/**/ /* !40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */ ;
/**/ /* !40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */ ;
/**/ /* !40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */ ;
--
-- Create schema SQLMapStudy
--
CREATE DATABASE IF NOT EXISTS SQLMapStudy;
USE SQLMapStudy;
--
-- Definition of table `SQLMapStudy`.`ORDER`
--
DROP TABLE IF EXISTS `SQLMapStudy`.` ORDER `;
CREATE TABLE `SQLMapStudy`.` ORDER ` (
`id` int ( 11 ) NOT NULL auto_increment,
` level ` int ( 11 ) default ' 0 ' ,
`name` text ,
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 42 DEFAULT CHARSET = latin1;
--
-- Dumping data for table `SQLMapStudy`.`ORDER`
--
/**/ /* !40000 ALTER TABLE `ORDER` DISABLE KEYS */ ;
LOCK TABLES ` ORDER ` WRITE;
INSERT INTO `SQLMapStudy`.` ORDER ` VALUES ( 24 , 5 , ' 233571 ' ),
( 25 , 3 , ' 237607 ' ),
( 26 , 4 , ' 951320 ' ),
( 27 , 4 , ' 3981449 ' ),
( 28 , 3 , ' 4201861 ' ),
( 29 , 3 , ' 4286204 ' ),
( 30 , 4 , ' 4467730 ' ),
( 31 , 4 , ' 4577921 ' ),
( 32 , 4 , ' 4644267 ' ),
( 33 , 4 , ' 4676767 ' ),
( 34 , 4 , ' 8718591 ' ),
( 35 , 4 , ' 1200488898355 ' ),
( 36 , 3 , ' 1200489291189 ' ),
( 37 , 3 , ' 1200489506119 ' ),
( 38 , 3 , ' 1200490058635 ' ),
( 41 , 4 , ' 1200490554236 ' );
UNLOCK TABLES;
/**/ /* !40000 ALTER TABLE `ORDER` ENABLE KEYS */ ;
/**/ /* !40101 SET SQL_MODE=@OLD_SQL_MODE */ ;
/**/ /* !40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */ ;
/**/ /* !40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */ ;
/**/ /* !40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */ ;
/**/ /* !40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */ ;
/**/ /* !40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */ ;
/**/ /* !40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */ ;
--
-- ------------------------------------------------------
-- Server version 5.0.45-Debian_1ubuntu3.1-log
/**/ /* !40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */ ;
/**/ /* !40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */ ;
/**/ /* !40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */ ;
/**/ /* !40101 SET NAMES utf8 */ ;
/**/ /* !40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */ ;
/**/ /* !40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */ ;
/**/ /* !40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */ ;
--
-- Create schema SQLMapStudy
--
CREATE DATABASE IF NOT EXISTS SQLMapStudy;
USE SQLMapStudy;
--
-- Definition of table `SQLMapStudy`.`ORDER`
--
DROP TABLE IF EXISTS `SQLMapStudy`.` ORDER `;
CREATE TABLE `SQLMapStudy`.` ORDER ` (
`id` int ( 11 ) NOT NULL auto_increment,
` level ` int ( 11 ) default ' 0 ' ,
`name` text ,
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 42 DEFAULT CHARSET = latin1;
--
-- Dumping data for table `SQLMapStudy`.`ORDER`
--
/**/ /* !40000 ALTER TABLE `ORDER` DISABLE KEYS */ ;
LOCK TABLES ` ORDER ` WRITE;
INSERT INTO `SQLMapStudy`.` ORDER ` VALUES ( 24 , 5 , ' 233571 ' ),
( 25 , 3 , ' 237607 ' ),
( 26 , 4 , ' 951320 ' ),
( 27 , 4 , ' 3981449 ' ),
( 28 , 3 , ' 4201861 ' ),
( 29 , 3 , ' 4286204 ' ),
( 30 , 4 , ' 4467730 ' ),
( 31 , 4 , ' 4577921 ' ),
( 32 , 4 , ' 4644267 ' ),
( 33 , 4 , ' 4676767 ' ),
( 34 , 4 , ' 8718591 ' ),
( 35 , 4 , ' 1200488898355 ' ),
( 36 , 3 , ' 1200489291189 ' ),
( 37 , 3 , ' 1200489506119 ' ),
( 38 , 3 , ' 1200490058635 ' ),
( 41 , 4 , ' 1200490554236 ' );
UNLOCK TABLES;
/**/ /* !40000 ALTER TABLE `ORDER` ENABLE KEYS */ ;
/**/ /* !40101 SET SQL_MODE=@OLD_SQL_MODE */ ;
/**/ /* !40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */ ;
/**/ /* !40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */ ;
/**/ /* !40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */ ;
/**/ /* !40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */ ;
/**/ /* !40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */ ;
/**/ /* !40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */ ;
要注意的问题:ENGINE=InnoDB
数据库映射对象类Order
/**/
/*
* Copyright (C) 2000-2007 Wang Pengcheng <wpc0000@gmail.com>
* Licensed to the Wang Pengcheng under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The LGPL licenses this file to You under the GNU Lesser General Public
* Licence, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Edit 15 Jan 2008
package com.studyspring.ch5;
public class Order ... {
private int id;
private int level;
private String name;
public int getId() ... {
return id;
}
public void setId( int id) ... {
this .id = id;
}
public int getLevel() ... {
return level;
}
public void setLevel( int level) ... {
this .level = level;
}
public String getName() ... {
return name;
}
public void setName(String name) ... {
this .name = name;
}
}
* Copyright (C) 2000-2007 Wang Pengcheng <wpc0000@gmail.com>
* Licensed to the Wang Pengcheng under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The LGPL licenses this file to You under the GNU Lesser General Public
* Licence, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Edit 15 Jan 2008
package com.studyspring.ch5;
public class Order ... {
private int id;
private int level;
private String name;
public int getId() ... {
return id;
}
public void setId( int id) ... {
this .id = id;
}
public int getLevel() ... {
return level;
}
public void setLevel( int level) ... {
this .level = level;
}
public String getName() ... {
return name;
}
public void setName(String name) ... {
this .name = name;
}
}
实现RowMapper:
/**/
/*
* Copyright (C) 2000-2007 Wang Pengcheng <wpc0000@gmail.com>
* Licensed to the Wang Pengcheng under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The LGPL licenses this file to You under the GNU Lesser General Public
* Licence, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Edit 15 Jan 2008
package com.studyspring.ch5;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
public class OrderRowMapper implements RowMapper ... {
* Copyright (C) 2000-2007 Wang Pengcheng <wpc0000@gmail.com>
* Licensed to the Wang Pengcheng under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The LGPL licenses this file to You under the GNU Lesser General Public
* Licence, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Edit 15 Jan 2008
package com.studyspring.ch5;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
public class OrderRowMapper implements RowMapper ... {
发表评论
-
[转载]Android与Java签名机制与API
2013-10-11 17:00 1187签名的两种方式 利用keystore文件进行签名 ... -
MMTk代码学习(RVM接口)
2012-11-06 14:52 1515前导 MMTk被RVM整个封装在后端,主要调用接口是 org ... -
MMTk代码学习(整体结构)
2012-11-05 17:03 2414必要的整体模块 对于一个完整的内存管理工具,主要涉及: ... -
嵌入式Java虚拟机 GC特性一览
2012-10-31 15:53 1257嵌入式Java虚拟机列表来源:http://en.wikipe ... -
Memory Analysis Tool OQL 用例汇总及语法学习
2012-10-28 16:36 2099典型用例 获取所有对象: SELECT * FROM $ ... -
Memory Analysis Tool 使用相关材料整理
2012-10-28 10:47 1967利用MAT分析问题 从转储(Dump)文件中调试并除错 ... -
JavaScript V8 引擎相关资料
2012-10-25 14:54 1035V8 Javascript engine之所以快 针 ... -
JDK 辅助工具
2012-09-18 19:16 958jps 虚拟机进程状况工具 jstat 虚拟机统计信息监视 ... -
Java Annotation入门
2012-07-14 16:37 782Java Annotation入门 http://www.b ... -
Android JNI 引用讨论
2012-06-11 11:04 1083原文参见:http://my.unix-center.net/ ... -
Java中的引用
2012-02-08 15:18 871强引用是不会被回收的,当内存不足时会抛出OutOfMemor ... -
CORBA相关材料
2009-05-21 17:09 1165CORBA入门 Java源码:CORBA入门 ... -
通过使用java.text package包中提供的类型,将数字类型装换成指定的格式。
2009-03-14 17:32 1348通过使用java.text package包中提供的类型,将数 ... -
最好不要用“局部变量”覆盖“字段”
2009-01-11 15:21 1227从编码习惯和语法规范上讲,很多程序员喜欢使用一些简单的变量作为 ... -
详解MANIFEST.MF文件
2008-10-19 17:33 1555打开Java的JAR文件我们经常可以看到文件中包含着一个M ... -
for,while,do-while,continue(无标号) 之间微妙的关系
2007-09-24 00:58 5705原来对continue的理解停留在表面,粗略的以为就是 在 ... -
Spring app 使用包的简化和注意的问题
2008-02-14 14:32 1818众所周知spring ... -
计算器制作JAVA版(综述)
2008-03-01 23:14 1625实在是不好意思,也不知道前一段时间在忙些什么,映象中就是吃饭和 ... -
计算器制作JAVA版(第一步,垃圾字符过滤)
2008-03-01 23:34 1590长话短说,直接进入正题。 首先是对于用户输入的字符进行过滤,滤 ... -
计算器制作JAVA版(第二步,表达式结构检查)
2008-03-02 00:00 1457这个问题一个特点--麻烦! 如何检查结构呢,结构错误是因为不符 ...
相关推荐
自己做的一个简单的spring运用实例,主要是关于事务回滚的一个小例子,希望对还在纠结事务回滚的童靴有点帮助。。。
花了一晚上时间终于搞出来了Spring整合Mybatis事务回滚(Mysql数据库),控制Service层中的多次插入操作,多次操作整体是一个事务。 里面有缘嘛和jar包,资源为war包,导入即可。运行Test类中的测试代码即可。 建表...
Spring/SpringMVC/MyBatis整合,可事务回滚
集成了Spring 3.2.2 Hibernate 3.3.2 Struts 2.3.4 用JPA的注解实现orm 不用创建数据库表 只需本机上有oracle即可 用JSR注解进行Spring的...用Spring Test整合Junit4 进行测试并自动事务回滚 不对数据库造成持久化操作
本篇文章主要介绍了浅谈Spring中@Transactional事务回滚及示例(附源码),小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
主要给大家介绍了关于mongoDB 4.0事务回滚的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用MongoDB具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
主要介绍了spring事务异常回滚实例解析,具有一定借鉴价值,需要的朋友可以参考下
Spring中@Transactional事务回滚(含实例详细讲解,附源码)Java开发Java经验技巧共8页.pdf.zip
主要介绍了使用SpringBoot注解方式处理事务回滚实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
Spring事务管理A方法内部调用B方法的回滚问题测试代码
Spring中的JdbcTemplate,Spring中的的事务.。。。。。。。
1. 基于Aspectj实现动态数据源...6. 实现事务内切换数据源(支持原生Spring声明式事务哟,仅此一家),并支持多数据源事务回滚(有了它除了跨服务的事务你需要考虑分布式事务,其他都不需要,极大的减少了系统的复杂程度)
使用MySQL时,如果发现事务无法回滚,但Hibernate、Spring、JDBC等配置又没有明显问题,到底是什么原因,下面与大家分享下
主要介绍了java Spring事务回滚的相关资料,需要的朋友可以参考下
主要介绍了SpringBoot事务使用及回滚实现代码详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
Spring Hibernate 事务处理 详细说明 Spring Hibernate 事务处理 详细说明
spring boot 纯注解方法事务控制回滚,注解+简单配置文件使用多线程demo
spring学习事务源码spring学习事务源码spring学习事务源码spring学习事务源码spring学习事务源码spring学习事务源码spring学习事务源码spring学习事务源码
Java高级编程 实验报告 spring 声明事务 实验目的 掌握spring 声明式事务管理配置 实验环境 本实验采用本实验采用的eclipse或者 Myeclpse开发工具。Spring 4.0以上 Jdk1.7以上、oracle/mysql。