HSQL一个简短的引论
仅一个hsqldb.jar文件就包含了数据库引擎。数据库驱动。还有其它用户界面操作等内容。在Java开源世界里。hsql是极为受欢迎的(就Java本身来说),JBoss应用程序server默认也提供了这个数据库引擎。因为其体积小的原因。又是纯Java设计。又支持SQL99。SQL2003大部分的标准。所以也是作为商业应用程序展示的一种选择。
结合Hibernate数据库无关的特性。很适合在项目开发的时候使用。
单元測试的时候,启动HSQLDB的file模式,数据不存盘,能够保证測试原子性。
package com.demandforce.dao; import java.util.Collection; import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.Assert; import com.demandforce.model.TextMessageTemplate; @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:context/hyperSqlContext.xml"})
public class TextMessageTemplateRetrievalTest { @Autowired
private TextMessageTemplateDao textMessageTemplateDao; @Test
public void testSelectByBusinessCategory() {
Collection<TextMessageTemplate> tmts = textMessageTemplateDao.selectByBusinessCategory( 203, 0);
Assert.notNull(tmts);
Assert.isTrue(tmts.size() == 2);
}
}
<?xml version="1.0" encoding="UTF-8"? >
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
<jdbc:embedded-database id="dataSource" type="HSQL">
<jdbc:script location="classpath:sql/setup.sql" />
<jdbc:script location="classpath:sql/schema-create.sql" />
<jdbc:script location="classpath:sql/data-insert.sql" />
</jdbc:embedded-database>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean name="baseDao" abstract="true">
<property name="dataSource" ref="dataSource" />
</bean> <bean name="textMessageTemplateDao" class="com.demandforce.dao.TextMessageTemplateDaoImpl" parent="baseDao" />
</beans>
--
-- MySQL compatibility mode for Hyper SQL SET DATABASE SQL SYNTAX MYS TRUE;
DROP TABLE IF EXISTS TextMessageTemplate; CREATE TABLE TextMessageTemplate (
ID INT NOT NULL AUTO_INCREMENT,
BusinessID INT NOT NULL,
Type INT NOT NULL,
Template varchar(1000),
CreatedDate datetime DEFAULT NULL,
LastModifiedDate timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
CreatedUserId INT DEFAULT 0,
LastModifiedUserId INT DEFAULT 0,
Delivery INT DEFAULT 0,
DeliveryWindow INT DEFAULT 1,
BusinessCalendar INT NOT NULL DEFAULT 0,
DeliveryTime datetime DEFAULT NULL,
CardCount INT DEFAULT 0,
Segment INT DEFAULT 0,
FrontImage varchar(255) DEFAULT NULL,
IncludeItems INT DEFAULT 1,
IncludeReview INT DEFAULT 1,
IncludeCoupon INT DEFAULT 1,
services varchar(5000) DEFAULT NULL,
Industry INT DEFAULT NULL,
PRIMARY KEY (ID)
);
INSERT INTO TextMessageTemplate (BusinessID, Type, Template, Industry)
VALUES ('0', '203', 'Template1', null); INSERT INTO TextMessageTemplate (BusinessID, Type, Template, Industry)
VALUES ('0', '204', 'Template2', null);
版权声明:本文博主原创文章,博客,未经同意不得转载。
HSQL一个简短的引论的更多相关文章
- Saiku一个简短的引论
一个简短的引论 Saiku成立于2008年,通过Tom Barber和Paul Stoellberger研究. 最初叫Pentaho分析工具.最初是基于OLAP4J图书馆的使用GWT采用前端分析工具包 ...
- Hibernate一个简短的引论
我们从几个方面进行阐述Hibernate When? What ? How? When? Hibernate由来是因为当时EJBBean1.1在处理entittBean架构时,花费的时间要比业务逻辑很 ...
- Jsoup一个简短的引论——采用Java抓取网页数据
转载请注明出处:http://blog.csdn.net/allen315410/article/details/40115479 概述 jsoup 是一款Java 的HTML解析器,可直接解析某个U ...
- Mybatis之ResultMap一个简短的引论,关联对象
基础部分能够查看我的还有一篇博客http://blog.csdn.net/elim168/article/details/40622491 MyBatis中在查询进行select映射的时候.返回类型能 ...
- Spark第一个研究笔记1一片 - Spark一个简短的引论
该公司推出的在线项目Spark拥有近1随着时间的推移.有效,Spark事实上,优秀的分布式计算平台,以提高生产力. 开始本篇笔记.此前的研究会Spark研究报告共享出来(由于篇幅的限制,它将被划分成制 ...
- Cache基础知识OR1200在ICache一个简短的引论
以下摘录<步骤吓得核心--软-core处理器的室内设计与分析>一本书 12.1 Cache基本知识 12.1.1 Cache的作用 处理器的设计者通常会声称其设计的处理器一秒钟能做多少次乘 ...
- HTML5分析实战WebSockets一个简短的引论
HTML5 WebSockets规范定义了API,同意web页面使用WebSockets与远程主机协议的双向通信. 介绍WebSocket接口,并限定了全双工通信信道,通过套接字网络. HTML5 W ...
- Oracle 指数 一个简短的引论
1 索引创建语法: CREATE UNIUQE | BITMAP INDEX <schema>.<index_name> ON <schema>.< ...
- PL/SQL一个简短的引论
前言 文本 PL/SQL (Procedure Language,程序语言)SQL 1999主要的数据库供应商提供结构化的共同语言 PL/SQL只有支持Oracle数据库 基本的语法 多行凝视 ...
随机推荐
- python的sorted() 函数
摘自:http://www.runoob.com/python/python-func-sorted.html sortedClassCount=sorted(classCount.items(),k ...
- jQuery----鼠标移动、点击案例
单击隐藏: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...
- HDU 1406 完数 因子的和
http://acm.hdu.edu.cn/showproblem.php?pid=1406 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6= ...
- 7、linux之定时器
(1) 一个timer_list 结构体的实例对应一个定时器,其定义如下: struct timer_list { struct list_head entry, /*定时器列表*/ unsigned ...
- iis windows phpstudy安装redis扩展
说明,我的服务器是2008 64位 php5.4.33 首先下载符合条件的redis扩展,是否符合条件可以参考https://pecl.php.net/package/redis,进入之后,点击&qu ...
- 【2013】将x插入有序数列
Time Limit: 3 second Memory Limit: 2 MB 将一个数x插入到有序数列a中,插入后a仍然有序. Input 第一行输入有序数列a的元素个数 第二行依次输入a的元素,以 ...
- Visual Studio 项目目录下的bin目录和 obj目录
一.Bin目录 Visual Studio 编译时,在bin 目录下有debug 和 release 目录. 1.Debug: 通常称为调试版本,它包含调试信息,所以要比Release 版本大很多(可 ...
- rabbitMQ服务安装
1.rabbitMQ简介 1.1.rabbitMQ的优点(适用范围)1. 基于erlang语言开发具有高可用高并发的优点,适合集群服务器.2. 健壮.稳定.易用.跨平台.支持多种语言.文档齐全.3. ...
- CentOS 7开放端口和关闭防火墙
开放端口 永久的开放需要的端口 sudo firewall-cmd --zone=public --add-port=3000/tcp --permanent sudo firewall-cmd -- ...
- 日志框架logj的使用
log4j 简介 是什么? Apache的一个开源的.轻量级的.用于日志管理的框架 有什么? Log4j由三个重要的组件构成:日志信息的输出格式,日志信息的优先 级,日志信息的输出目的地. 1,日志信 ...